Found an unexpected Mach-o Header code:0x72613c21 xcode 9.2 - ios

First of all, I am new to xCode and have developed iOS app which has already been working in Android perfectly. But when I convert the same into Xcode, I found so many error that I removed myself gradually.
My problem is that I add the project in Xcode, add reference library
etc and build the project. after so many error, finally my build start and end at BUILD SUCCESSFUL. Afterward, I start archiving the project and it completed but when I export it shows me Found an unexpected Mach-o header code. I google it and found so many solution but all in vain.
Critical.log 2018-06-18 17:15:43 +0000 Failed to generate
distribution items with error: Error Domain=DVTMachOErrorDomain Code=0
"Found an unexpected Mach-O header code: 0x72613c21"
UserInfo={NSLocalizedDescription=Found an unexpected Mach-O header
code: 0x72613c21, NSLocalizedRecoverySuggestion=}
Standard.log2018-06-18 17:15:37 +0000 [MT] Beginning distribution
assistant for archive: kRide, task: Export 2018-06-18 17:15:42 +0000
[MT] Proceeding to distribution step
IDEDistributionAnalyzeArchiveStepViewController, context:
',
distributionTask(resolved)='2',
distributionMethod(resolved)='', team(resolved)='(null)'> Chain (3, self inclusive):
',
distributionMethod='', team='(null)'> ',
distributionMethod='', team='(null)'> ',
distributionMethod='(null)', team='(null)'>
Please suggest me where I am wrong and what I need to do to export the project to have .ipa file

try to DELETE BUILD folder from IOS directory and rebuild again with
react-native run-ios

Related

IPA Processing Failed: Could not resolve #executable_path

I am stuck with this error when exporting IPA.
I did refer similar questions and none of them worked for me.
I am migrating my project from carthage to SPM, most of the frameworks which I use support SPM and only two had XCFrameworks.
Have added XCFrameworks with Embed & Sign, and earlier I used to have the simulator architectures removal script, with XCFrameworks I have removed that from my build phase step now.
When looked in the standard log I could not spot any error when searched with "fail"
Is there anything in the standard log which would indicate an error which I should be looking for ?
EDIT: Before you close as Duplicate of How to fix "IPA processing failed" error in xcode 11?
Please check this is for Xcode 12 with SPM & XCFrameworks !
The only errors I can spot in the logs are below:
2021-02-10 09:37:47 +0000 Scanning IPA...
2021-02-10 09:37:50 +0000 warning: Failed to resolve rpath for **SDK: Could not resolve #executable_path for #executable_path/Frameworks from **SDK
2021-02-10 09:37:50 +0000 warning: Failed to resolve rpath for ***: Could not resolve #executable_path for #executable_path/Frameworks from ***
But when I compared with the logs from another project with similar set up, I can see the same set of "warnings" and I am able to generate IPA on the another project.

xcodebuild ios export archive fail on success build

I am trying to build a complicated xcworkspace that contains 8 xcodeproj.
Main project (target app, framework, app extension)
Pods
6 cpp projects with one static library target each (these have dependencies with each other and added to the final project)
I can build the project via xcodebuild command. I am also able to Archive it, but I cannot export the IPA file, it always gets the following error:
2020-03-18 19:04:49.801 xcodebuild[28749:691158] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/vr/1fb5zcxd0gg92359ynn0r2gm0000gn/T/xxxxx_2020-03-18_19-04-49.800.xcdistributionlogs'.
2020-03-18 19:04:49.834 xcodebuild[28749:691158] [MT] IDEDistributionMethodManager: -[IDEDistributionMethodManager orderedDistributionMethodsForTask:archive:]: Error = Error Domain=IDEDistributionMethodManagerErrorDomain Code=2 "Unknown Distribution Error" UserInfo={NSLocalizedDescription=Unknown Distribution Error}
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but no value was provided
Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but no value was provided" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but no value was provided}
I also tried to use the XCode 10.3 (10G8) UI in order to perform the same actions. This results to the Organizer screen where I see the xcarchive erroneous located in a group "Other Items" and not "iOS Apps" as it should.
Additionally, the option
"Validate Content" is disabled.
"Distribute Content" does not provide anything for iOS packing.
I have verified that my build commands are correct as the project was able to build with these in its previous state.
I've tried changing static project libraries dependencies but when adding all dependencies to all items it ends with a build error of multiple symbols.
I suspect that something in the build settings, or library/header references is faulty, but I cannot really troubleshoot it.
Is there any way to get additional information for the problem?
I had the same issue. I had to reset my developer certificate on our build server to resolve this.
I hope this helps others.

Xcode 8.2.1 Failed to codesign archive

I am trying to upload an archive for test flight to itunesconnect. However, when I go to validate the archive I get an error message saying that code signing failed and that a .ipa file is missing. I have scoured the internet for quite some time and can't find a viable solution to fixing this problem.
Xcode: Version 8.2.1 (8C1002)
Deployment Target: iOS 8.0+
IDEDistribution.standard.log:
2017-03-15 20:25:03 +0000 [MT] Validation failed for archive ******* with issues: IDEDistributionIssue: severity(error), error(Error Domain=ITunesSoftwareServiceErrorDomain Code=-21013 \"The archive is invalid. /var/folders/yc/y1chf6z95zj63mnsw7m6qwm80000gn/T/XcodeDistPipeline.6rX/Packages/*******.ipa does not exist.\" UserInfo={NSLocalizedDescription=The archive is invalid. /var/folders/yc/y1chf6z95zj63mnsw7m6qwm80000gn/T/XcodeDistPipeline.6rX/Packages/*******.ipa does not exist., NSLocalizedFailureReason=Unable to validate your application.})
IDEDistribution.critical.log
2017-03-15 20:19:52 +0000 [MT] Presenting: Error Domain=IDEFoundationErrorDomain Code=1 "Codesign failed" UserInfo={NSLocalizedDescription=Codesign failed}
I got it working. We are using Carthage libraries in the project, and I guess the code signing of the libraries we were using didn't like our project for some reason. I manually placed the source code for the libraries into the project and it ran fine.

Codesigning fails during IPA validation with nested frameworks

I am trying to archive an app and prepare it for distribution in the App Store.
During the validation of the archive (which can be triggered from XCode's Organizer) the following error pops up:
From what I can tell some of my frameworks which contain nested frameworks cannot be codesigned. If I remove all frameworks which contain nested frameworks then it starts working again.
As an example the following framework causes such an error:
Frameworks are build using Carthage
Here is the log output I am seeing:
2016-12-02 10:16:53 +0000 Processing step: IDEDistributionCodesignStep
2016-12-02 10:16:53 +0000 Applying entitlements delta for <IDEDistributionItem: 0x7fbc6f6e2a00 'com.hearst.ObjectMapper' '<DVTFilePath:0x7fbc530bde70:'/Users/gruener/Library/Developer/Xcode/Archives/2016-12-02/TestSubmitApp 02-12-16 11.16.xcarchive/Products/Applications/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework'>'> from <IDEiCloudEntitlementsProcessor: 0x7fbc6e036e70>: {
}
2016-12-02 10:16:53 +0000 Combining entitlements for <DVTFilePath:0x7fbc525ceb00:'/var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/Root/Payload/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework'>
bundleIdentifier = com.hearst.ObjectMapper
profileEntitlements = {
}
storedEntitlements = {
}
extraEntitlements = {
}
2016-12-02 10:16:53 +0000 Entitlements for <IDEDistributionItem: 0x7fbc6f6e2a00 'com.hearst.ObjectMapper' '<DVTFilePath:0x7fbc530bde70:'/Users/gruener/Library/Developer/Xcode/Archives/2016-12-02/TestSubmitApp 02-12-16 11.16.xcarchive/Products/Applications/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework'>'>: {
}
2016-12-02 10:16:53 +0000 Writing entitlements for <IDEDistributionItem: 0x7fbc6f6e2a00 'com.hearst.ObjectMapper' '<DVTFilePath:0x7fbc530bde70:'/Users/gruener/Library/Developer/Xcode/Archives/2016-12-02/TestSubmitApp 02-12-16 11.16.xcarchive/Products/Applications/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework'>'> to: /var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/entitlementsuaGdWl
2016-12-02 10:16:53 +0000 Running /usr/bin/codesign '-vvv' '--force' '--sign' 'A54D9A9C895E402713C0528523674342C777C825' '--preserve-metadata=identifier,resource-rules' '--entitlements' '/var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/entitlementsuaGdWl' '/var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/Root/Payload/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework'
2016-12-02 10:16:53 +0000 Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
2016-12-02 10:16:53 +0000 /var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/Root/Payload/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework: replacing existing signature
2016-12-02 10:16:53 +0000 /var/folders/3r/_6fw2smn4vj099_d7j2jtt0cg18svh/T/XcodeDistPipeline.bXb/Root/Payload/TestSubmitApp.app/Frameworks/Dto.framework/Frameworks/ObjectMapper.framework: invalid resource directory (directory or signature have been modified)
2016-12-02 10:16:53 +0000 /usr/bin/codesign exited with 1
I also tried building the IPA file with Fastlane's GYM. In this it works, however when I try to submit the App I receive this error:
WARNING ITMS-90686: "The binary you uploaded was invalid. (1102)"
Googling the error code 1102 yielded no results;
I finally figured out what the problem was.
I ran lipo info /path/to/Dto.framework/Dto in a terminal and everything seemed fine - unnecessary architectures were correctly stripped away. But taking a closer look at the nested frameworks I realized that this was not the case for them.
Instead I found out that when working with Carthage you have to link all frameworks at app level and must not encapsulate them in your own frameworks.
So to solve this I removed the Copy files Phase (which copies all frameworks to the frameworks directory). Carthage is smart enough to recognize this and also checks out the nested dependencies and builds them for you. The only thing you have to do then, is to add it to your Link Libraries Build Phase in XCode.
Can you check what kind of architectures are in the Dto.framework and ObjectMapper.framework?
You can do this with
$ file /path/to/Dto.framework/Dto
It seems similar to the issue I had with some embedded frameworks built for device and simulator. Simulator archs are built with debug, and they cannot be submitted to the AppStore (archiving for ad-hoc worked well). If they contain simulator archs (x86_64, and i386), you can use the script described in this blog to strip simulator archs during release builds of application: https://gkbrown.org/2015/12/17/creating-a-universal-ios-framework-in-xcode-7/

Found an unexpected Mach-O header code: 0x72613c21 on submitting to App Store

I know there are a lot of possible solutions but none of them have worked for me so far. I am using a framework called Alamofire.framework and Kingfisher.framework. I built an iOS App which I would like to submit to AppStore. I archived it and then I come in the Archives window and click "Upload to App Store".
The following error occurs: "Found an unexpected Mach-O header code:
0x72613c21" with the following logs:
IDEDistribution.critical.log
2016-01-08 06:00:47 +0000 [MT] Failed to generate distribution items
with error: Error Domain=DVTMachOErrorDomain Code=0 "Found an
unexpected Mach-O header code: 0x72613c21"
UserInfo={NSLocalizedDescription=Found an unexpected Mach-O header
code: 0x72613c21, NSLocalizedRecoverySuggestion=} 2016-01-08 06:00:47
+0000 [MT] Presenting: Error Domain=DVTMachOErrorDomain Code=0 "Found an unexpected Mach-O header code: 0x72613c21"
UserInfo={NSLocalizedDescription=Found an unexpected Mach-O header
code: 0x72613c21, NSLocalizedRecoverySuggestion=}
IDEDistribution.standard.log
2016-01-08 06:00:47 +0000 [MT] Beginning distribution assistant for
archive: UCDA, task: Validate 2016-01-08 06:00:47 +0000 [MT]
Automatically selecting the only availaable distribution method
2016-01-08 06:00:47 +0000 [MT] [OPTIONAL] Didn't find archived user
entitlements for
:
Error Domain=NSCocoaErrorDomain Code=4 "Item at
"/Users/chikitin/Library/Developer/Xcode/Archives/2016-01-07/UCDA
1-7-16, 11.59
PM.xcarchive/Products/Applications/UCDA.app/Frameworks/FBSDKLoginKit.framework"
did not contain a "archived-expanded-entitlements.xcent" resource."
UserInfo={NSLocalizedDescription=Item at
"/Users/chikitin/Library/Developer/Xcode/Archives/2016-01-07/UCDA
1-7-16, 11.59
PM.xcarchive/Products/Applications/UCDA.app/Frameworks/FBSDKLoginKit.framework"
did not contain a "archived-expanded-entitlements.xcent" resource.}
2016-01-08 06:05:27 +0000 [MT] Canceled distribution assistant
IDEDistribution.verbose.log
2016-01-08 06:00:47 +0000 [MT] IDEDistributionItem init
I hope someone could help me with this.
Thanks a lot!
I ran into this error with a FacebookSDK framework. I removed it from the Embed frameworks list and it solved the issue. Inspect the log and find the framework causing the error.
I have the same issue with facebook SDK ... I create a bug task on facebook (bug report), the problem appears with the new SDK version .
And No solution works ...
If you have found a solution let us know. Thank you.
I run my app without facebook connect actually.
You need to remove any Frameworks’ related files in the "Copy Bundle Resources” in the build phases. Please see https://kobkrit.com/how-to-fix-found-an-unexpected-mach-o-header-code-0x72613c21-on-submitting-to-app-store-7d5b8ec180c
Remove any frameworks or folders with frameworks from Build Phases -> Copy Bundle Resources:
This solved the error for me!
I had no frameworks folder but had ios folder in Build Phases -> Copy Bundle Resources, I removed ios folder and rebuild the project, created archive again, it worked for me.

Resources