How to build a release version of an iOS framework in Xcode? How to build a release version of an iOS framework in Xcode? ios ios

How to build a release version of an iOS framework in Xcode?


To get a release build, you need to change your scheme settings:

enter image description hereAlternatively, create a new scheme for release builds.

Ensure you have a device selected. Not the simulator.

enter image description here

Build your project and you should see that it gets added to this location:(Click the arrow to navigate there in finder)enter image description here

And after drilling down, you should be able to find the release folder with your release framework inside.enter image description here


This works for me:

Select your framework target then click Product -> Archive. If organizer window does not pop up after successful build of your framework then go to "Build Settings" of your framework target, look for the option "Skip Install" and change it to "No" (and after that Archive again).


An alternative to building a framework via the Xcode IDE is to build it from the command line.

You can produce a release build of your framework for iphoneos devices with the following command:

xcodebuild -workspace TestSDK.xcworkspace -scheme TestSDK -configuration Release -sdk iphoneos

You can change the value of the -configuration argument from Release to Debug in order to produce a debug build, or change the value of the -sdk argument from iphoneos to iphonesimulator in order to produce a build for Simulator devices.

Note that you may need to provide the -project argument instead of -workspace if your target is part of an Xcode project only and not part of an Xcode workspace. Run the xcodebuild -help command for the full list of xcodebuild options.

If you prefer to archive, you can do that from the command line also, as follows:

xcodebuild archive -workspace TestSDK.xcworkspace -scheme TestSDK -configuration Release -sdk iphoneos -archivePath "TestSDK_Release_iphoneos.xcarchive" SKIP_INSTALL=NO

Note that you can specify SKIP_INSTALL=NO as part of your project or target's Build Settings instead if you prefer.

Lastly, if you want to join up your iphoneos and iphonesimulator builds into a single binary, you can do that with the xcodebuild -create-xcframework command as follows:

xcodebuild -create-xcframework \    -framework "TestSDK_Release_iphoneos.xcarchive/Products/Library/Frameworks/TestSDK.framework" \    -framework "TestSDK_Release_iphonesimulator.xcarchive/Products/Library/Frameworks/TestSDK.framework" \    -output "TestSDK.xcframework"

See here for the official guide to creating an XCFramework.


matomo