28

What causes the error

Found an unexpected Mach-O header code: 1918975009 in xCode 6

I archived my project to send out as an ad hoc build and it builds/links/archives just fine but when I'm in the xCode organizer and select Export -> Ad Hoc,

I get the error

Found an unexpected Mach-O header code: 191897500. 
2
  • This is also encountered due to any Mach-O setting set to "Static" in the build setting. Feb 26, 2015 at 14:46
  • Are you linking your project against some iOS Universal Framework target? Feb 26, 2015 at 16:41

10 Answers 10

37

In my case this issue ("found an unexpected mach-o header code 0x72613c21") appeared after I've installed Crashlytics, Fabric.

Somehow pods appeared to become an embedded binary. So I had to remove it, pod install once more, and the issue disappeared.

Remove pods from embedded binaries

7
  • 1
    This was it for me! Thanks so much for posting this
    – Aron
    Dec 15, 2015 at 11:16
  • Great! Works like charm in my case (Fabric install from pod)
    – Hoang HUA
    Feb 2, 2016 at 19:47
  • +Great! Works like charm in my case (Fabric install from pod)
    – Alper
    Mar 8, 2016 at 12:50
  • I have a framework added in Embedded Binaries but i can remove. I need the framework as Embedded. Any other idea?
    – jose920405
    May 11, 2016 at 19:45
  • I don't use pods, but the issue was the same. I removed Crashlytics and Fabric from the Embedded binaries and kept them only in Linked frameworks and Binaries. That worked, thanks.
    – nmdias
    Apr 15, 2017 at 4:27
35
+50

I had the same error. In my case it was caused by an universal framework that I accidentally copied into the resources of the app (which is unnecessary, since frameworks get merged directly into the main executable on iOS AFAIK).

So, select your target, click the "Build Phases" tab, and look through the "Copy Bundle Resources" list to see if you copy a library or framework that contains desktop architectures (i386 or x86_64).

Most likely, copying such a file is wrong, but if for some reason you have to, apparently it can only contain iOS compatible architectures.

4
  • @YohanesKhosiawan许先汉Yes. I was using the wrong version of a framework in my project. Once I switched it to the non-desktop version, the issue was fixed.
    – rtvanals
    Nov 6, 2014 at 14:34
  • 1
    This is also encountered due to any Mach-O setting set to "Static" in the build setting. Feb 26, 2015 at 14:47
  • I'm getting this for the MoPub framework. Any other suggestions? How do I see if the framework contains desktop architectures? Aug 1, 2015 at 17:16
  • Hello, I am getting this warning for GoogleMaps on adding GoogleMaps.Bundle to Copy Bundle Resources . How to resolve this?
    – TechSavy
    May 11, 2016 at 6:52
11

Had a similar error 1918975009 with the new Swift build system in Xcode 9.3 (under Workspace Settings...) on a third-party framework that was manually added (not using Cocoapods). Maybe related to the above thread so in case it helps anyone... This only appeared after upgrading to Xcode 9.3 after it released officially yesterday. Xcode 9.2 and earlier on the new build system did not throw the warning.

:-1: <path>/Frameworks/<frameworkName>.framework/<frameworkName>: Failed to parse executable: Unknown header: 1918975009

Switching back to the old non-Swift-based build system fixes the issue. Not an optimal solution but if you're seeing a similar warning, will let you move on for now.

2
  • 4
    I have the same issue since upgrading to Xcode 9.3, but switching back to the old build system is not the solution I'm looking for. Anyone have other ideas?
    – Jeehut
    Apr 3, 2018 at 11:09
  • I have the same issue since I have updated to Xcode 9.3. I would guess that having a new version of that framework built with swift 4.1 would help. Although since it is third party framework I can't test till I get update from authors.
    – iur
    Apr 3, 2018 at 11:58
4

I have been experiencing the same error and wasn't able to trace it to library / framework in copy bundle resources, or an incorrect version of a library.

As a workaround, I've found that I can do an export build from the command line and it seems to work:

xcodebuild -exportArchive -exportFormat ipa \
-archivePath /path/to/app.xcarchive/ \
-exportPath /path/to/app.ipa \
-exportProvisioningProfile "Name of provisioning profile"

Here "Name of provisioning profile" is the name of the provisioning profile as it appears in Xcode (not the path to the profile)

1
  • works for me, but why? i not understand this method. If you share in testflight, or more importantly, if it is sent to appStore. What are the risks? It is operating normally?
    – jose920405
    May 11, 2016 at 19:54
2

Go to BUILD PHASES -> COPY BUNDLE RESOURCES, you will find there some framework. Remove from this section and add it to LINK BINARY WITH LIBRARIES. It will work..

1

sometimes, you should look Build Phases - Embed Pods Frameworks. and find the shell file. eg.

Build Phases

and open Pods-midea-common-adddevice_Example-frameworks.sh See if this file is a problem.

0

I just ran into this issue as well, and I was able to solve it...

In my case, I had created a new target by duplicating an existing one. I had changed the name from "MyApp-dev copy" to "MyApp-test", however, I forgot one thing... When you create a new target, a new .plist file is also created. I forgot to rename that file, and then link it back to my newly created target.

Once I had done that, the problem went away. I had originally been reading about targets at: http://www.raywenderlich.com/68613/create-paid-lite-version-iphone-app and going back through that page is what helped me solve the problem.

0

solved problem in my case

Build Phases -> Copy Bundle Resources for a framework or other binary that shoundn't be there

i delete TwitterKit and DigitKit binary.

Edit: When i delete this binary from Copy Bundle Resources, project can be build, archived, pass to validation and also sent to App Store. But when i run the project it's fails. So, if i delete from Copy Bundle Resources and than add to Link Binary With Library sections(we choose "Add other" and than press cmd + shift + g combination to go where your bundle or binary) it's solved.

0

To add fabric or crashlytics into your project, when drag or add frameworks to project folder or to Xcode , keep 'copy items if needed' box unchecked.enter image description here

0

Check that you are not embedding an static framework in the "Embedded Binaries" section in the General tab of the target.

AFAIK You can check if the framework is static if the binary icon inside the .framework is white, if the icon is black then is a dynamic framework.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.