iOS: App Store Mach-O error
“Found an unexpected Mach-O header code: 0x72613c2” App Store upload error
This guide may apply to all frameworks that create or generate iOS applications and use Swift Package Manager.
When uploading your app with embedded Smartlook or another static library Swift Package, you may experience the following:
Found an unexpected Mach-O header code: 0x72613c2
error that protects you from uploading the app to the App Store.
The cause of this error is a bug in Xcode that does not handle static libraries being added via Swift Package Manager properly. The static libraries are linked right, but then they are packaged to the app archive to be set to the App Store as if they are dynamic.
To fix this, use the following steps:
- Add Swift Package as normal
- Navigate to you app target General info pane
- In the left column Project Navigator, reveal the Swift Package structure
- Drop the xcproject to Frameworks, Libraries, and Embedded Content list next to the library already added by the Swift Package Manager
- Change its Embed type to Do Not Embed
- Remove the original reference (ignore the warning about removing the dependency)
- Delete the Xcode derived data folder content (usually in
~/Library/Developer/Xcode/DerivedData
)
From now on, Xcode should treat the static library added in Swift Package as expected.
Updated almost 3 years ago