Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode 7.1 swift framework app builds but not archiving

Tags:

xcode

ios

swift

I have created a sample Framework in Swift, xcode 7.1. The framework is then built for Profiling, released version. Released framework then added(embedded) to an iOS test app.

The app builds fine, but when trying to archive it. An error occurs, stating "bitcode bundle could not be generated because '.../Test/FW.framework/FW' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture arm64"

The Framework and app projects are on default settings, Bitcode enabled for both.

To make sure Framework have bitcode, this command on Framework

"otool -l FW.framework/FW | grep __LLVM"

yields

segname __LLVM

segname __LLVM

segname __LLVM

segname __LLVM

What am I missing? I have included both projects here, you can download them and try archiving.

like image 234
parveenkhtkr Avatar asked Nov 07 '15 07:11

parveenkhtkr


People also ask

How do I archive a build in Xcode?

Navigate to your project's settings. Under iOS (or the target you want to build your app for) > Identity, you'll want to increment the Build number. For example, if the Build number was 1, you'll want to set it to 2. Then, in the top menu, under Product, click on Archive.

How do I archive iOS apps in Xcode?

Archive your App In Xcode with your project open, select the simulator (button near the top of the window next to your project name, typically named as a specific type of iPhone) – change it to Generic iOS Device. Open the Product menu and choose Archive. You will see the archive information. Click Validate App.

Where is archive Xcode?

Open the Archives folder in Finder: Library > Developer > Xcode > Archives. If it does not exist, create the folder with today's date in the format "YYYY-MM-DD", for example: 2021-11-05. Paste the . xcarchive folder previously copied into the folder that has just been created.

How do I import an archive into Xcode?

Just drag the . xcarchive in Xcode and it will be added to the Xcode Organizer.


2 Answers

xcode requires that bitcode for all embedded frameworks is generated during archiving.

Copying the release build of framework/dylib isn't enough

do
archive the framework and THEN use the archived version of the framework from then on.

to get xcode to archive a framework (normally it only archives apps), set the build setting 'skip install' to NO for the framework target!

like image 171
Daij-Djan Avatar answered Oct 18 '22 00:10

Daij-Djan


You can make the following if you can build the framework (for example if you use your own framework)

enter image description here

This will allow your framework to provide the required bitcode.


Another alternative option may be applicable if you dont have watchOS and Apple TV (according to docs)

For iOS apps, bitcode is the default, but optional. If you provide bitcode, all apps and frameworks in the app bundle need to include bitcode. For watchOS and tvOS apps, bitcode is required.

this option require to set ENABLE_BITCODE for every target in buildSetting to NO, but as expected this forbid to use bitcode functionality.

More about bitcode here

like image 23
hbk Avatar answered Oct 18 '22 00:10

hbk