Universal iOS infrastructure with iphoneos and iphonesimulator architecture

xcodebuild can build a project with sdk installed on either iphoneos or iphonesimulator , but not both, so to create a framework containing armv7 arm64 and i386 x86_64 , I need to run xcodebuild twice and then use lipo to combine all architectures into 1 universal binary file. I see a commercial structure that does this, but leads to an incorrect info.plist file because it has a field, CFBundleSupportedPlatforms , and all signs point to it containing only 1 value, for example, CFBundleSupportedPlatforms = ( "iPhoneSimulator" ) .

It seems that lipo should not be used this way because it is not officially supported by xcodebuld . Is there a better way to create a structure to hold all architectures?

+5
source share
1 answer

I am following this question, but I guess I'm a little puzzled by why you want to unnecessarily inflate one .framework only with the i386 and x84_64 simulators that really only apply to your designs. Do you happen to want to distribute the structure to other developers and want it to work both on the simulator and on the device?

If so, you are on the right track, using lipo to join the thin binaries for the device together or join the thin binaries for the simulator together, but should not try to create one device and simulator platform. Apple uses the SDK and Framework as a guide. Inside Xcode, there are two different platform SDKs - iPhoneOS.platform and iPhoneSimulator.platform, which contain SDKs with only slices for the corresponding target architectures:

Xcode Platform Parameters

You can drill through each of these folders and find that the UIKit framework really matches the idea of ​​each platform and is conditionally related based on the SDK that is used:

Uikit lipo

I would suggest that you would like to have a universal, universal infrastructure so that developers do not have to remember one .framework file for another, depending on how they compiled the application. The great news is that you can use conditional anchor flags to be able to influence this without requiring a file system exchange!

As people accept your library, part of the installation should be to use conditional binding. In the OTHER_LINKER_FLAGS parameter OTHER_LINKER_FLAGS you can configure the configuration parameters (Debug, Release, Ad-Hoc, etc.), as well as for each architecture or for individual SDK settings:

Other linker flags

To access these SDK settings, you need to click + next to each build configuration where you want to configure custom binding. You can then select the appropriate SDKs from the drop-down list and add linker flags for each of the two target frameworks.

+3
source

All Articles