App Store submission
Unsupported Architecture
x86 issue
iOS development
app architecture

Submit to App Store issues Unsupported Architecture x86

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

When developing an application for iOS and submitting it to the App Store, developers often encounter a variety of technical hurdles. One of the common issues is related to "Unsupported Architecture x86". This article dives deep into this problem, providing technical explanations and offering guidance on how to resolve it effectively.

Understanding the Architecture Issue

Apple's App Store requires applications to be compiled for ARM architectures (armv7, arm64, etc.) because these are the architectures used by iOS devices. The x86 architecture, on the other hand, is typically used for simulators on macOS. An application that includes x86 architecture cannot be uploaded to the App Store, which results in a rejection.

Why is x86 Part of the Issue?

The x86 architecture's inclusion usually happens during the development phase for use in the iOS Simulator, which runs on a Mac's CPU architecture. If not properly excluded during the build process, binaries containing x86 architecture may be inadvertently submitted to the App Store:

  • x86: Used by 32-bit x86 apps on Macs.
  • x86_64: Used by 64-bit applications running on the macOS environment, like simulators.

These architectures are useful for testing but are unnecessary and unsupported when deploying a release build to physical devices or the App Store.

Symptoms of the Issue

When submitting an app including x86 architecture to the App Store, developers might encounter an error message like:

 
Unsupported architecture: x86_64

This error indicates that the app binary contains executable code in the x86_64 architecture, which is not permissible on the App Store.

Solutions to Rectify Unsupported Architecture

Here are steps to ensure your app binaries are correctly configured before submission:

1. Swift Package Manager

When using Swift Package Manager, it’s usually straightforward, but critical check the packaging:

  • Ensure no dependencies include unnecessary architectures.
  • Testing can be done on simulators but make sure to strip these architectures before archiving.

2. Manual Stripping Script

A common practice is to add a script in the build phases of the Xcode project. Here is an example script to remove simulator architectures:

bash
1APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
2
3# This script loops through the frameworks embedded in the application and removes
4# unnecessary simulator architectures.
5
6find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
7do
8  FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
9  FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
10  echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
11
12  EXTRACT_ARCHS=$(lipo -info "$FRAMEWORK_EXECUTABLE_PATH" | rev | cut -d ':' -f1 | rev)
13
14  for ARCH in $EXTRACT_ARCHS
15  do
16    if [[ "$ARCH" == "i386" || "$ARCH" == "x86_64" ]]; then
17      lipo -remove "$ARCH" -output "$FRAMEWORK_EXECUTABLE_PATH" "$FRAMEWORK_EXECUTABLE_PATH" || exit 1
18      echo "Removing $ARCH architecture."
19    fi
20  done
21done

3. Using EXCLUDED_ARCHS in Xcode

Xcode allows the setting of architecture rules. Doing this filters out unwanted architectures.

  • Select your project and target in Xcode, go to the Build Settings, and look for Architectures.
  • Set the EXCLUDED_ARCHS to x86_64, i386 for Release builds.

4. Validating the Final Binary

Always make a final check on your binary using command-line tools before submitting:

bash
lipo -info <path_to_your_app>.app/<your_app_executable>

This command lists the architectures included in the final binary, helping ensure that only supported architectures remain.

Table Summary of Key Points

AspectDescription
Causex86 architectures are included during simulator testing.
SymptomsErrors from App Store submission, such as "unsupported architecture".
SolutionsStripping script, set EXCLUDED_ARCHS.
ToolsXcode's Build Settings, command-line tools like lipo.
Validation Commandlipoinfo<yourexecutable>lipo -info <your_executable> for verifying architectures.

Additional Considerations

Checking Third-Party Libraries

Ensure that any third-party libraries included in your project are also correctly architectured. Static libraries can especially often have redundant architectures which need to be stripped away in a similar fashion.

Automating the Process

To simplify development workflows, consider automating the stripping process using CI/CD pipelines or pre-submit hooks, ensuring unwanted architectures are never mistakenly submitted.

By understanding the intricacies of iOS architecture requirements and implementing these solutions, developers can avoid the hiccups associated with unsupported architectures during App Store submissions. It not only accelerates the deployment process but also aligns with best practices in developing for iOS.

By following the above recommendations, you ensure that your app is free of unsupported architectures so that submissions to Apple's App Store go smoothly.


Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.