xcode 7.1 swift framework app builds but not archiving
Asked Answered
A

2

15

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.

Antiproton answered 7/11, 2015 at 7:53 Comment(5)
seems the bitcode formats don't match. was the framework exported via archiving it?Darling
No, just built it for Profiling, then found the FW.framework in "Release-iphoneos" along with a separate file "FW.framework.dSYM".Antiproton
How can I export it via archiving? When I archive the framework, it says build succeeded and nothing happens. Do I need to look for archived framework output fileAntiproton
maybe building for archiving works too but to allow it to be put into an archive, set the build setting 'skip install to NO'Darling
That did the trick, thanks! I was going insane over this. Please add the steps as answer, I will accept it. ( 'skip install to NO' on framework project, then archive, export with save built product and that Framework output file works with bitcode enabled)Antiproton
D
37

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!

Darling answered 7/11, 2015 at 9:42 Comment(12)
It works, but not enough... Project now builds successfully with framework, but while uploading to iTunesConnect I receive an error...Fallfish
` An error occurred during validation The archive did not contain <DVTFilePath:0x7f9bea07f750:'/Users/me/Library/Developer/Xcode/Archives/2015-12-16/Project_name 16-12-15 16.16.xcarchive/BCSymbolMaps/D1F093C6-C59A-3761-8C62-8D74B8629FB23.bcsymbolmap'> as expected.`Fallfish
K. I'm lost. How do you produce it? Have you checked if it has module map at all?Darling
The error occurred while uploading archive to iTunesConnect... Additional error info screenshot What do You mean with "checked if it has module map at all" ?Fallfish
The error says there is no ipa?! Can you export the archive as an ipa?Darling
Unfortunately I can't export the archive as an ipa. There are also 2 alerts as in screenshots: screenshotsFallfish
Only working solution that I find is disabling bitcode.Fallfish
I've found workaround. In my framework target -> Build Settings, I've added User-Defined Setting called BITCODE_GENERATION_MODE with value "bitcode" as on Screenshot. Finally after archiving, just use Fastlane tool called Pilot and archive is uploading to iTunesConnect successfully.Fallfish
Thanks, setting the SKIP INSTALL to NO worked since the framework has to have to BITCODE to NO for a store upload. Then can export the archive to framework and then copy / use that for the app.Sprint
setting enable bitcode to No, in Build Settings, helped me.Ploughman
One more point, which wasn't explicitly stated, was to extract the .framework file from the .xcarchive. Embedding this .framework into my project allowed me to archive my project without generating the bitcode error.Dentistry
Thank you so much man! It worked well with the archived version of framework. +1 for youRagman
S
36

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

Scarcely answered 8/8, 2016 at 13:28 Comment(7)
I think this answer should also get some credit. With this approach, you do not have to run the framework through the archive process.Limiting
this is a much better solution than the one that is the accepted answer. FYI to future people who might see this.Shire
This worked for me, Building as Archive Did not. on XCode 8.3Hilmahilt
Great answer. Worked for me, building as archive did not on XCode 9.0.Conners
@Bem i have this issue : #54438278 adding BITCODE_GENERATION_MODE helped in this case also?Feodora
@Feodora I'm not really sure whether it will work in that case, but I suggest you to try it out.Farriery
@gbk, I added BITCODE_GENERATION_MODE and it worked perfectly even with my ENABLE_BITCODE set to yes? Why dod you suggest i set it to NO ? Will i run into future problems ?Kannry

© 2022 - 2024 — McMap. All rights reserved.