Xcode 12 introduces support for Apple Silicon Macs. Even though you're working on an iOS project, this can impact you as developers now need to build for arm64 simulators, an architecture that used to be reserved to physical iDevices.

Linking error

After updating, your project might fail to build if you update to Xcode's recommended build settings.

The error looks like this:

❌  ld: in /Users/.../Batch/Batch.embeddedframework/Batch.framework/Batch(Batch-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/.../Batch/Batch.embeddedframework/Batch.framework/Batch'

There are two solutions to this:

  • Update to Batch 1.16 (currently in private beta)
  • Disable arm64 simulator builds temporarily

If you already updated to Batch 1.16 but are still encountering this error, this is due to Batch being used with the old fat framework distribution method.

  • If you're integrating manually, please migrate to the XCFramework distribution.
  • If you're integrating using Carthage, you will need to disable the arm64 simulator builds until Carthage supports XCFrameworks and Batch releases a compatible version.
  • If you're integrating using Cocoapods, make sure you're using a cocoapods version that supports Xcode 12 (1.10 and higher). If this still doesn't work, please contact our support team.

Disabling the simulator arm64 build

First, open your main target's Build Settings and expand Excluded Architectures.

Next to Debug, click on +.

Then, click on Any SDK on the line that was added, and select Any iOS Simulator.

Double click on the empty space on the right, press + in the popup and write arm64.

Press enter and click outside of the popup.

Repeat the steps for Release. Your build settings should look like this:

You might need to repeat the steps for your test target.

BatchExtension error when archiving for the App Store

BatchExtension was originally distributed as a closed source dynamic framework. It may cause bitcode issues when submitted using Xcode 12.

New integrations should be made using the open-source version of the extension, using Swift Package Manager.

Cocoapods and Carthage releases are coming soon.

You can migrate to the new extension in a few steps:

  1. Remove BatchExtension.framework from your project
  2. In your main target's build settings, remove the "Run Script" phase that calls strip-frameworks.sh of BatchExtension's folder
  3. Open Xcode's File menu, and pick Swift Packages > Add Package Dependency...
  4. (Optional, Xcode may not prompt you) Select the project you need to integrate the extension into
  5. Enter https://github.com/BatchLabs/Batch-iOS-SDK-Extension in the URL bar
  6. When asked for version information, keep the default values and press Next
  7. Select your Extension target in Add to Target
  8. You're done! The extension should be source compatible with your existing code.
Did this answer your question?