可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
So i am trying to use the shopify API. When i archive the app and validate it then there are no issues but when i submit it to the app store then it gives me the following issues.
- ERROR ITMS-90087: "Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]'."
- ERROR ITMS-90209: "Invalid segment Alignment. The App Binary at SJAPP.app/Frameworks/Buy.framework/Buy does not have proper segment alignment. Try rebuilding the app with the latest xcode version." (I am already using the latest version.)
- ERROR ITMS-90125: "The Binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's Linker."
- WARNING ITMS-90080: "The Executable Payload/..../Buy.framework is not a Position Independent Executable. Please ensure that ur build settings are configured to create PIE executables."
Note for 2017 if using Carthage, you just forgot to click copy-frameworks, and/or you accidentally left it in embed-frameworks.
回答1:
The problem is that the Buy framework contains a build for both the simulator (x86_64) and the actual devices (ARM).
Of course, you aren't allowed to submit to the App Store a binary for an unsupported architecture, so the solution is to "manually" remove the unneeded architectures from the final binary, before submitting it.
Daniel Kennett came up with a nice solution and provides this script to add to the build phase:
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" # This script loops through the frameworks embedded in the application and # removes unused architectures. find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK do FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" EXTRACTED_ARCHS=() for ARCH in $ARCHS do echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME" lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") done echo "Merging extracted architectures: ${ARCHS}" lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" rm "${EXTRACTED_ARCHS[@]}" echo "Replacing original executable with thinned version" rm "$FRAMEWORK_EXECUTABLE_PATH" mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" done
I used it and it worked perfectly.
EDIT: make sure you look at the modified script posted by Varrry, as this one has some minor issues.
回答2:
If you're using Carthage then you may experience this issue because the project is:
- Missing the
carthage copy-frameworks
build phase. - Or the build phase doesn't include all the frameworks (incomplete list).
This action filters frameworks to a list of valid architectures (code).
Setting up the copy-frameworks build phase
From the Carthage building for iOS steps:
On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:
/usr/local/bin/carthage copy-frameworks
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
$(SRCROOT)/Carthage/Build/iOS/Box.framework
$(SRCROOT)/Carthage/Build/iOS/Result.framework
$(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework
This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.
回答3:
Answer given by pAkY88 works, but I faced the same problem as Mario A Guzman in https://stackoverflow.com/a/35240555/5272316: once we cut off unused architectures we can't run script any more since it tries to remove not existing slices, because xcode doesn't re-embed binary every time. Idea was - just remove i386 and x86_64 slices when building for archive, so I modified script:
echo "Target architectures: $ARCHS" APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK do FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH") FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp" # remove simulator's archs if location is not simulator's directory case "${TARGET_BUILD_DIR}" in *"iphonesimulator") echo "No need to remove archs" ;; *) if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH" echo "i386 architecture removed" rm "$FRAMEWORK_EXECUTABLE_PATH" mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH" fi if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH" echo "x86_64 architecture removed" rm "$FRAMEWORK_EXECUTABLE_PATH" mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH" fi ;; esac echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH" echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH") done
This script simply removes i386 and x86_64 slices from fat binary (if they exist) if running not for simulator (that means destination folder isn't like "Debug-iphonesimulator").
Sorry, I'm not familiar with shell scripts, so may be someone could write it more elegant way. But it works)
回答4:
I resolved the error ITMS-90080 by removing a framework (the excellent SVProgressHUD) from the Embedded Binaries section (Xcode target -> General tab).

回答5:
If you are using Carthage
make sure your Embed Frameworks
Build Step
is before the Carthage
copy-frameworks
In some unusual cases (example: Lottie-iOS framework):
you will have it simply in "Link Library" as usual.
However you have to also explicitly add it in "Embed Frameworks" (even though that seems pointless, since it works perfectly when you have it only in "Embed Frameworks"),
and put it in copy-frameworks
and ensure copy-frameworks is after "Embed Frameworks"
回答6:
I removed architectures i386 & x64_86 from Build Settings - Valid Architectures - Release, and everything worked just fine.

Now the only issue would be that you can't run a RELEASE build for testing purposes on a SIMULATOR. But as easily as you removed the archs, you can add them back if you want to.
回答7:
This error (ITMS-90240) can also be caused by a static (.a) library. heres a script to strip the excess architectures. In Xcode add this to Target > BuildPhases > Click the + and select Run Script. Then paste this into the script box.
The script searches for .a files, checks to see if it contains an offending architecture, then if it does makes a new .a file without that architecture.
For macOS:
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" STRIPARCHS="armv7 armv7s arm64" for t in $STRIPARCHS do if find "$APP_PATH" -name '*.a' -exec lipo -info {} \; | grep $t ; then find "$APP_PATH" -name '*.a' -exec lipo -remove $t {} -output {}2 \; -exec rm {} \; -exec mv {}2 {} \; ; fi done exit 0
For iOS :
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" STRIPARCHS="x86_64 i386" for t in $STRIPARCHS do if find "$APP_PATH" -name '*.a' -exec lipo -info {} \; | grep $t ; then find "$APP_PATH" -name '*.a' -exec lipo -remove $t {} -output {}2 \; -exec rm {} \; -exec mv {}2 {} \; ; fi done exit 0
回答8:
Your framework contains both ARM
and x86
code, which allows you to use it on a device or in the simulator. If you intend to submit your app to the App Store, run the following script to strip the inactive code from the binary.
1.Select your target in the Project Navigator, and click Build Phases at the top of the project editor.
2.From the Editor menu, select Add Build Phase, then Add Run Script Build Phase (or click the + button in the upper-left corner of the Build Phases editor).
3.Expand the disclosure triangle next to the new Run Script build phase that was just added. In the script editor box, paste the following: bash
${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/"YourframeworkName.framework"/strip-frameworks.sh
回答9:
I had same issue. Even it was not working after adding the given Run Script. It was Xcode related issue. I was using the Xcode version 9.0 but latest version was 9.2.
So i installed latest Xcode (9.2) and it worked.
回答10:
I had same issue even after adding the script and updating the framework a few times.
Make sure in xCode the script is added at the end, after the embed. I think I accidentally moved the script before the embedded framework.

Note: I have xCode 9.1