Andrei  Trotsko
Andrei Trotsko

Reputation: 347

Xcode 10 Invalid binary architecture?

I have an iOSapp that support iOS 11/12. I've been submitting builds to App Store Connect for TestFlight without issue using the Xcode 10. Today I submitted a build using Xcode 10, and I got the following email:

Dear Developer,We identified one or more issues with a recent delivery for your app, "DevelopAP". Please correct the following issues, then upload again. Invalid Binary Architecture - iOS 3.0 introduced support for multiple binary architectures. If your binary is built for multiple architectures, your Info.plist must have a MinimumOSVersion key with a value of at least 3.0. Additionally, if your app is intended to support earlier iPhone and iPod touch models, your app must contain at least an armv6 binary; "thin" armv7-only binaries will not be accepted unless the armv7 required device capability is also present in the Info.plist UIRequiredDeviceCapabilities key or the MinimumOSVersion key has a value of 4.3 or higher. Specifically, we found the following unsupported architectures in your binary:

x86_64. Deployment Target - 10.0 Swift Language version - 3.3 Pods deployment target version - 10.0

I tried to use armv6 in info.plist. And try build in Xcode 9.4.1. And try use start scrips but this issue still have in this project.

If anyone has any thoughts, it'd be much appreciated.

Upvotes: 1

Views: 589

Answers (2)

gnasher729
gnasher729

Reputation: 52530

They found the architecture "x86_64". That's a 64 bit Intel processor. Can you show me any iPhone with an Intel processor? They don't exist. So find out where the 64 bit Intel code sneaked into your project and remove it.

Trying to add armv6 is seriously misguided. armv6 is something you will find on an iPhone 3GS. Your application should support aarch64 or arm64 (it's required), and armv7 if you are interested in supporting 32 bit devices, that would be iPhone 5/5c or older.

Upvotes: 0

Andrei  Trotsko
Andrei Trotsko

Reputation: 347

Add this Run Script to your project

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    

Upvotes: 1

Related Questions