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

10

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. 
Waler answered 25/10, 2014 at 6:38 Comment(2)
This is also encountered due to any Mach-O setting set to "Static" in the build setting.Elodea
Are you linking your project against some iOS Universal Framework target?Jecoa
P
35

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.

Pentstemon answered 5/11, 2014 at 14:16 Comment(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.Waler
This is also encountered due to any Mach-O setting set to "Static" in the build setting.Elodea
I'm getting this for the MoPub framework. Any other suggestions? How do I see if the framework contains desktop architectures?Avoirdupois
Hello, I am getting this warning for GoogleMaps on adding GoogleMaps.Bundle to Copy Bundle Resources . How to resolve this?Benilda
F
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

Firebreak answered 14/12, 2015 at 11:32 Comment(7)
This was it for me! Thanks so much for posting thisIncommensurable
Great! Works like charm in my case (Fabric install from pod)Renick
+Great! Works like charm in my case (Fabric install from pod)Moonshiner
I have a framework added in Embedded Binaries but i can remove. I need the framework as Embedded. Any other idea?Groschen
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.Bureaucrat
Thank you so much. I have the same problem and it works for me 😍Meaty
after two days, thanks .. but whyyy?? it was working fine before!!Obelize
P
35

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.

Pentstemon answered 5/11, 2014 at 14:16 Comment(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.Waler
This is also encountered due to any Mach-O setting set to "Static" in the build setting.Elodea
I'm getting this for the MoPub framework. Any other suggestions? How do I see if the framework contains desktop architectures?Avoirdupois
Hello, I am getting this warning for GoogleMaps on adding GoogleMaps.Bundle to Copy Bundle Resources . How to resolve this?Benilda
M
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.

Moncear answered 30/3, 2018 at 18:59 Comment(2)
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?Windowlight
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.Gennygeno
G
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)

Gorey answered 21/12, 2014 at 22:19 Comment(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?Groschen
I
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..

Isomerism answered 21/9, 2016 at 12:43 Comment(0)
T
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.

Teague answered 19/9, 2017 at 9:33 Comment(0)
S
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.

Spasmodic answered 25/8, 2015 at 13:42 Comment(0)
P
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.

Purdah answered 10/6, 2016 at 12:1 Comment(0)
B
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

Brescia answered 9/10, 2017 at 9:18 Comment(0)
F
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.

Fluctuate answered 5/9, 2018 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.