简体   繁体   中英

How do I release a universal swift framework that will submit to the app store?

I am currently developing a framework that is meant to be released and included by clients for submission to the app store.

Currently, I am executing the following

#!/bin/sh

xcodebuild -target MyFramework -sdk iphoneos -configuration Release clean build

xcodebuild -target MyFramework -sdk iphonesimulator -configuration Release clean build

mkdir build/Release-iphoneuniversal

cp -R build/Release-iphoneos/MyFramework.framework build/Release-iphoneuniversal/

cp build/Release-iphonesimulator/MyFramework.framework/Modules/CNVRTagManager.swiftmodule/*  build/Release-iphoneuniversal/MyFramework.framework/Modules/CNVRTagManager.swiftmodule/

lipo build/Release-iphoneos/MyFramework.framework/MyFramework build/Release-iphonesimulator/MyFramework.framework/MyFramework -create -output build/Release-iphoneuniversal/MyFramework.framework/MyFramework

This creates a great little framework that I can include in projects which I can then build for simulator or device. I can archive fine too. Of particular note, I have added the custom build setting

BITCODE_GENERATION_MODE=bitcode

to ensure bit code is included properly.

The problem? Well, here's what happens when I submit the working app to the app store.

ERROR ITMS-90087: "Unsupported Architectures. The executable for CV FreeCell.app/Frameworks/MyFramework.framework contains unsupported architectures '[x86_64, i386]'." ERROR ITMS-90087: "Unsupported Architectures. The executable for CV FreeCell.app/Frameworks/MyFramework.framework contains unsupported architectures '[x86_64, i386]'."

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'CV FreeCell.app/Frameworks/MyFramework.framework/MyFramework' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version." ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'CV FreeCell.app/Frameworks/CNVRTagManager.framework/MyFramework' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.”

WARNING ITMS-90080: "The executable 'Payload/CV FreeCell.app/Frameworks/MyFramework.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library." WARNING ITMS-90080: "The executable 'Payload/CV FreeCell.app/Frameworks/MyFramework.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library.

Now I'm tempted to think that I must release one framework for simulator and one for devices. Is that the case? Is there a resource somewhere that I am missing?

Thanks.

Best practice is to create a combined framework. One that has support for both Devices and the Simulator.

This process usually involves building the framework for both architectures separately, and then lipo them together.

You can also use a script for this which will take care of the merge for you whenever you build your framework.

This answer here should give you some more guidance on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM