Universal Frameworks and Requirements for Deployment

I got some beacons from a company who provides an SDK to connect to them. They provided two sets of framework files which the SDK is dependent on. The first set is built for Arm 64, and the second is built for x86.

I am using them to build a framework for a company which says they require frameworks they integrate into their apps to work for both device and simulator. I think this is primarily for convenience during development.

I've run into some walls trying to fulfill these requirements and have some questions about what is possible.

  1. The Beacon manufacturer claims the x86 framework files should work for both simulator and device during development, and that arm64 would be for deployment to the app store. I am unable to get x86 to work during development when my device is plugged in though. What does a framework need to work for both device and simulator?

  2. Is is possible, from strictly arm64 and strictly x86 framework files, to build universal framework files that supports both arm64 and x86? Then from those to build a new universal framework that leverages all of those?

  3. Can this resulting framework not only be used for development on simulator and device, but also be deployed to the app store?

Thank you kindly, for your expertise.

Answered by Developer Tools Engineer in 795643022

This doesn’t depend on the architectures for which the frameworks are built, it depends on the platforms for which the frameworks are built—and in our ecosystem, devices and simulators are considered different platforms.

Therefore, if you’re developing and deploying for macOS, the provider of the frameworks should build them as a universal binary for x86_64 and arm64 architectures since both architectures are in use on one platform.

However, if you’re developing and deploying for iOS, the provider of the frameworks should provide separate simulator and device frameworks, since those are separate platforms and must not be combined into a single binary, regardless of the architectures involved. (A simulator binary can have both arm64 and x86_64, after all, since the simulator runs on both macOS architectures.)

Accepted Answer

This doesn’t depend on the architectures for which the frameworks are built, it depends on the platforms for which the frameworks are built—and in our ecosystem, devices and simulators are considered different platforms.

Therefore, if you’re developing and deploying for macOS, the provider of the frameworks should build them as a universal binary for x86_64 and arm64 architectures since both architectures are in use on one platform.

However, if you’re developing and deploying for iOS, the provider of the frameworks should provide separate simulator and device frameworks, since those are separate platforms and must not be combined into a single binary, regardless of the architectures involved. (A simulator binary can have both arm64 and x86_64, after all, since the simulator runs on both macOS architectures.)

@Developer Tools Engineer

We got a new framework from the manufacturer. When I run lipo info on the 3 framework files I'm trying to build with I get:

  1. Architectures in the fat file: ...MTBeaconPlus.framework/MTBeaconPlus are: x86_64 arm64

  2. Architectures in the fat file: ...iOSDFULibrary.framework/iOSDFULibrary are: x86_64 arm64

  3. Architectures in the fat file: ...ZIPFoundation.framework/ZIPFoundation are: x86_64 arm64

I added "arm64" and "x86_64" to my architectures list in build settings.

I want to build my framework now for "Any iOS simulator device (arm64, x86_64)"

I'm getting an error saying:

building for 'iOS-simulator', but linking in dylib (...MTBeaconPlus.framework/MTBeaconPlus) built for 'iOS'

Why is this happening? It would make sense to me that you'd need framework files built for x86_64 and arm64 as lipo found when building for this option "Any iOS simulator device (arm64, x86_64)"

Universal Frameworks and Requirements for Deployment
 
 
Q