ChatGPT解决这个技术问题 Extra ChatGPT

Xcode 7 and ENABLE_BITCODE=YES setting does not work

I have followed several threads around the new ENABLE_BITCODE setting in Xcode, have also tried as much as I can (admitted I'm not a xcode pro) but still cannot get the project to compile for use on my test phone?

My app runs fine on the simulator but I cannot deploy it onto my iPhone for testing. On latter one I just installed iOS 9 beta.

Now, here is the error message I receive. It appears the setting does not impact the PARSE.com lib, that is part of my project? How can I get my project to deploy onto my phone? Thanks for any advice.

    Ld /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-  bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods/Parse.framework/Parse normal armv7
cd /Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -L/Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods -L/Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods/Parse -F/Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods -filelist /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Intermediates/Pods.build/Debug-iphoneos/Pods-Parse.build/Objects-normal/armv7/Parse.LinkFileList -install_name @rpath/Parse.framework/Parse -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=8.0 -dead_strip -fembed-bitcode-marker -ObjC -lParseLib -lz -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Accounts -weak_framework Social -ObjC -fobjc-arc -fobjc-link-runtime -framework AudioToolbox -framework Bolts -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework Foundation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Intermediates/Pods.build/Debug-iphoneos/Pods-Parse.build/Objects-normal/armv7/Parse_dependency_info.dat -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods/Parse.framework/Parse

---
ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers
ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers
ld: '/Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods/Parse/libParseLib.a(PFSQLiteDatabase.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Are you sure you've selected Enable Bitcode to NO against build config you're using (eg DEBUG)? You can check it out in project->target->build settings-> search enable bitcode->set NO in DEBUG (good to remember to try to update libs before test release, maybe it'll contain bitcode already). Then Edit Scheme -> Run -> check if you have DEBUG config atm.
WELL! yes and no. I did not set it on the POD targets, that was my overlook. Your hint got me there. Thanks
Great to hear it :) will post it as an answer as it may be useful for other people.
Why we need to change Bitcode? Previously we not need to update its value. Any logical reason? Thanks
Did it all but still the app crash on the device with the same error. I am using iOS 9.1. Please help!

Z
Zorayr

Are you sure you've selected Enable Bitcode to NO against build config you're using (eg DEBUG)? You can check it out in project->target->build settings-> search enable bitcode->set NO in DEBUG (good to remember to try to update libs before test release, maybe it'll contain bitcode already). Then Edit Scheme -> Run -> check if you have DEBUG config atm.

https://i.stack.imgur.com/BGTkB.png


@Zorayr As you've added image to my post: you should firstly check your app build settings and change this flag in app build settings. Only if it doesn't help, then do the same with Pods.
Will the application be accepted in the App store if the Enable Bitcode is set to NO ?
@NeAS Yes. Currently, there is no requirement to enable bitcode.
M
Maxim Veksler

Note that for projects using CocoaPods you should set ENABLE_BITCODE = NO on both the project and the Pods container project targets.

This error

Ld /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos/ParseTwitterUtils.framework/ParseTwitterUtils normal arm64
    cd /Users/maximveksler/Developer/ParseUI-iOS/Pods
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -L/Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos -L/Users/maximveksler/Developer/ParseUI-iOS/Pods/ParseTwitterUtils -F/Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos -filelist /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Intermediates/Pods.build/Debug-iphoneos/ParseTwitterUtils.build/Objects-normal/arm64/ParseTwitterUtils.LinkFileList -install_name @rpath/ParseTwitterUtils.framework/ParseTwitterUtils -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -fembed-bitcode-marker -ObjC -lParseTwitterUtilsLib -lsqlite3 -lz -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Accounts -weak_framework Social -fobjc-arc -fobjc-link-runtime -framework AudioToolbox -framework Bolts -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework Foundation -framework Parse -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -single_module -compatibility_version 1 -current_version 1.8.1 -Xlinker -dependency_info -Xlinker /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Intermediates/Pods.build/Debug-iphoneos/ParseTwitterUtils.build/Objects-normal/arm64/ParseTwitterUtils_dependency_info.dat -o /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos/ParseTwitterUtils.framework/ParseTwitterUtils

ld: '/Users/maximveksler/Developer/ParseUI-iOS/Pods/ParseTwitterUtils/libParseTwitterUtilsLib.a(PFTwitterAuthenticationProvider.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

was resolved by:

https://i.stack.imgur.com/KlEj3.png

https://i.stack.imgur.com/K3189.png


Does Apple reject app if we submit it with option Enable Bitcode = NO?
@G.Ganesh please post as a separate question. The policy varies between tvOS and watchOS where the answer is YES. iOS the answer is currently no, future YES.
@GaneshGuturi Currently yes, but probably Apple will cut it at some point in the future. More explanation eg here: stackoverflow.com/a/31207170/849616.
S
Stefan Stoichev

I had also faced the same problem in Xcode7. Solution for this:

go to PROJECT

build Settings

select All Tab

type in search Enable Bitcode

Update Flag to No (which will be beneath of your project (second column))


A
ArturOlszak

I had similar problem with GoogleAnalytics cocoa pod library, and the library was not compiling for iPhone 6 with iOS 8.

My solution was to turn to NO "Enable Bitcode" flag in target of the application project - not in Pods project.


That's what I've said in the comment to my answer. To try to do it on project settings, if and only if that's not working then switch to pod project.
Switching the target and the project to build settings bitcode NO does not work for ARCHIVING. Does work find for Sim builds. XCODE 7.0.1
e
ethemsulan

If your Bitcode is not showing please selec All. When xcode select Basic your Bitcode option is not showing.

https://i.stack.imgur.com/M5qn7.png

https://i.stack.imgur.com/TKmWL.png


A
Alexander

I just set it for my project.

MyProjectTarget -> Build Settings -> Enable Bitcode = NO


Will the application be rejected in the App store?
G
GabLeRoux

As everybody said, the answer is set Enable Bitcode to No in build settings, but I think some of you might be interested in doing this from the command line.

My Xcode project is being generated by Unity and I don't want any manual intervention on the Xcode project settings. Maybe there's a better way or a tool that can edit Build Settings a bit like how PlistBuddy lets you update values in plist files. I don't know any tool that does this for build settings so I'm using sed.

sed: Run replacements based on regular expressions.

How to set Enable Bitcode to No from command line:

Here, my project name is Unity-iPhone so I run the following command from the root of my Xcode project:

sed -i -e 's/ENABLE_BITCODE = YES;/ENABLE_BITCODE = NO;/g' \ 
Unity-iPhone.xcodeproj/project.pbxproj

-e -- specify sed commands to run -i -- edit files in-place, running scripts separately for each file

Remove -i if you only want a preview of what it does ;)

Note that all of your build configurations will be changed using this command, the line ENABLE_BITCODE = YES; appeared 6 times in my project.pbxproj.

Now my build steps can be fully automated as fastlane takes care of the rest!


h
haroon jamil

https://i.stack.imgur.com/JjdaZ.png


Please add some code to better explain your answer.
J
Jaxs_ios

try this command in terminal if you arn't able to change BITCODE settings withing the project,

xcodebuild -target "target" -configuration "configuration" ENABLE_BITCODE=NO


H
Hugo Jordao

If you are using Cocoapods, this will solve the problem:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now