Scenario
The Strategy Mobile iOS SDK project is downloaded and opened in Xcode. Compilation and archiving is a success without any errors being shown, but when attempting to upload the compiled application to the App Store, errors similar to the following are thrown and the upload is rejected:
- Unsupported Architectures. "The executable for Strategy.app/Frameworks/StrategyMobileSDK.framework contains unsupported architectures '[x86_64, i386]'."
- Invalid CFBundleSupportedPlatforms value. "The key 'CFBundleSupportedPlatforms' in the Info.plist file in bundle 'Payload/Strategy.app/StrategyMobileSDKResources.bundle' contains an invalid value '[iPhoneSimulator]'. Consider removing the CFBundleSupportedPlatforms key from the Info.plist. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."
- Invalid Segment Alignment. "The app binary at 'Strategy.app/Frameworks/StrategyMobileSDK.framework/StrategyMobileSDK' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
- 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. The binary does not seem to have been built with Apple's linker."
Cause
The StrategyMobileSDK.framework contains two architectures:
- x86_84 - used for testing with the Xcode simulator.
- ARM - used on real devices for normal use.
Before distribution for deployment via the App Store, Apple requires for the app and any embedded frameworks to only contain the necessary architecture to run on real devices, else warnings such as these are thrown.
Solution
Compiled binaries binaries such as these can be stripped to contain only specific architectures using the "lipo" command. One way that lipo can be used, is through a custom bash script that executes as a "Run Script" build phase during the compilation process.