Bitcode signature failure in Xcode

2019-01-15 13:08发布

问题:

I updated Xcode to the last version, and now when I'm trying to compile the project I'm getting an error "Invalid bitcode signature", hovewer, the bitcode for my project is disabled. How can I fix it? What should I change to sign my bitcode correctly?

My Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'MyProjectName' do

pod 'Realm'
pod 'CorePlot'
pod 'GoogleMaps'

end

I checked already, everything is fine with it.

回答1:

I'm not sure if you have the same situation with me. I only have this issue when I tried to test with iPhone device. It turns out that the debug configuration with Build Active Architecture Only is set to NO. After I set to YES, I can test with my iPhone.



回答2:

I experienced this error, but it happened only when building for an iOS 10.3 iPad (despite working on an iOS 10.3 iPhone and an iOS 11.0 iPad, and all the iOS 10.3 and 11.0 simulators). Through painful process of elimination (and creating a new project from scratch), I found that my Cocoapods weren't at fault, nor was my code signing settings, nor my AppExtension, nor my tests, nor my 'build for active architecture only' setting, nor any build setting related to the term 'bitcode'.

In my setup, I had a C++ Xcode project nested within my main Swift/iOS Xcode project. Because it was never intended specifically for use in iOS, the "iOS Deployment target" had never been set (it was left on 'default'). Upon setting it explicitly to 10.3, it worked without complaint.

Nested C++ app's project settings (set iOS deployment target to the lowest iOS version you support):

Nested C++ app's target settings (for reference):



回答3:

If you using pod then please check the version of all libraries, some library may be not supporting in new version , you have to update pod files for that library.



回答4:

In my case, I was trying to build for a device with an iOS version lower than the deployment target.



回答5:

On my case problem occured because of I was using a 3rd party static library with different files for each architecture

I fixed the problem by removing binaries of invalid architectures. Instead I added a multi-arch FAT binary for the 3rd party static library

Hope helps



回答6:

This kind of problem came up when I linked a new static library project to my workspace. In order to solve it I tried to set both the Build Active Architecture Only and the Bitcode settings of the library to NO but no luck. Then I got across the thing that the library's Deployment Target was set to 11.0 as Xcode set the latest value to all new projects. After fixing the setting to 5.0 the problem was solved.



回答7:

For my case, the solution was removing a c++ library.



回答8:

I found that my issue was with using 'Modules'.

Just turned off modules (had to update some header files), but that resolved my issue.

Enable Modules In Settings



回答9:

In my case, the widget included in the project was causing the bitcode error.

I changed my pod file from this:

target "App" do
    pod 'A'
    pod 'B'
end

target "App Widget" do
    pod 'A'
end

to this:

target "App" do
    pod 'A'
    pod 'B'

    target "App Widget" do
        pod 'A'
    end
end


回答10:

To fix this issue, most answers recommend a workaround whereby you clean your Xcode workspace/project, close Xcode, delete your Derived Data folder (this is kept in the root directory of your project by default), then finally re-open your project.

However, the above steps may not work for you. This is a hint that your project structure is in error.

When the bitcode intermediary representation of your project was released with iOS 9.0, it was done so on the provision that your entire project, including dependencies, either totally agree to use bitcode or not. From my experience, it is vital to work through all of your Pods and included Libraries/Frameworks and ensure they all use the same setting; either Yes or No. By default, this selection is Yes.

If a single dependency does not match the intended bitcode setting, this error can be thrown.

When sanity checking your dependencies and overarching project, it is important to note that there is a Use Bitcode setting for both the Project and the Target settings, so be sure to check both perspectives of the Build Settings.



回答11:

I was adding static library . I created fat binary of the same library including all architectures and included in my project. This resolved my issue



回答12:

In my case, I am Using Cordova Project. While building it with Xcode had the same issue and Resolved by Removing and Adding the IOS platform.

cordova platform remove ios

cordova platform add ios


回答13:

If you are using cocoa pods then do "pod update"



回答14:

Targets -> Build Settings ->Build Active Architecture Only

Debug -> YES Release -> NO to YES

I face the same problem only on archiving the app.

Who can tell me the reason? You can teach all developers. It's awesome.