Submit to App Store issues: Unsupported Architecture x86
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.
Submit to App Store issues: Unsupported Architecture x86_64,i386 (IBMMobileFirstPlatformFoundation.framework) +IONIC 2 + IBM MFP 8.0
I had the same issue while using another framework ("Intercom"). I was also adding it in embedded binaries and the run script to select the correct architecture. The solution that worked for me is -
- Remove the corresponding framework and run-scripts that are creating the problem. Then compile and run the code.
- Add the embedded framework first and then add the run-script. Please make sure the order in the build phases should be like the embedded framework above the run script which you use to select the correct architecture.
This worked for m, I hope this will help you too.
Unsupported Architectures when uploading to App Store
The problem was that Xcode precompiles the dynamic library for both the simulator (i386) and devices (x86_64). You can implement this run script to remove the unused architecture.
iOS Carthage Submit to App Store issues: Unsupported Architecture, Invalid Segment Alignment
This issue was resolved by modifying the run script from the generally accepted answer and executing after embedding frameworks.
/usr/local/bin/carthage copy-frameworks
#!/usr/bin/env bash
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"
if [ ! -f "${FRAMEWORK_EXECUTABLE_PATH}" ]; then
continue
fi
if xcrun lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | grep --silent "Non-fat"; then
echo "Framework non-fat, skipping: $FRAMEWORK_EXECUTABLE_NAME"
continue
fi
echo "Thinning framework $FRAMEWORK_EXECUTABLE_NAME"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
xcrun lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
xcrun 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
ERROR ITMS-9000: Unsupported architectures. Your executable contains unsupported architectures '[x86_64, i386]'
Check out this slick solution on Daniel Kennett's blog - it worked perfectly for me with the SpritzSDK, which I had similar issues with.
He supplies a script you can drop-in to your build phases to strip out the unwanted architectures as a last step - doesn't break the simulator, and iTunesConnect approved my upload as well on the first try.
http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
Related Topics
Difference Between Observedobject and Stateobject in Swiftui
Core Data: Quickest Way to Delete All Instances of an Entity
Disabling User Selection in Uiwebview
How to Save Picture to Iphone Photo Library
Any Way to Pre Populate Core Data
How to Enable File Sharing For My App
Swift 2.0 - Binary Operator "|" Cannot Be Applied to Two Uiusernotificationtype Operands
How to Use Userdefaults in Swift
Tricks For Improving Iphone Uitableview Scrolling Performance
Ios 7: Uitableview Shows Under Status Bar
What Does Enable_Bitcode Do in Xcode 7
How to Find Out the Type of an Object (In Swift)
Iphone Keyboard Covers Uitextfield
Convert HTML to Plain Text in Swift
Creating a Uicollectionview Programmatically
How to Download Multiple Files Sequentially Using Nsurlsession Downloadtask in Swift
How to Adjust the Anchor Point of a Calayer, When Auto Layout Is Being Used