Disable bitcode for project and cocoapods dependencies with Xcode 7?
There is a way to build CocoaPods' targets with full bitcode. Just add -fembed-bitcode
option to OTHER_CFLAGS
of each:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
cflags << '-fembed-bitcode'
config.build_settings['OTHER_CFLAGS'] = cflags
end
end
end
I think this way is better than disabling bitcode.
project 'frameworkTest.xcodeproj'
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'frameworkTest' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for frameworkTest
source 'https://github.com/CocoaPods/Specs.git'
#zip files libs
pod 'SSZipArchive'
#reachability
pod 'Reachability'
end
#bitcode enable
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# set valid architecture
config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s i386 x86_64'
# build active architecture only (Debug build all)
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['ENABLE_BITCODE'] = 'YES'
if config.name == 'Release' || config.name == 'Pro'
config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
else # Debug
config.build_settings['BITCODE_GENERATION_MODE'] = 'marker'
end
cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
if config.name == 'Release' || config.name == 'Pro'
cflags << '-fembed-bitcode'
else # Debug
cflags << '-fembed-bitcode-marker'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
end
end
For disable bitcode for your own development pod only add this below code in pod file of the projects.
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "YOUR SDK TARGET NAME"
puts "Processing for disable bit code in YOUR SDK TARGET NAME SDK"
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
end
To set this setting in a way that doesn't get overridden each time you do a pod install
you can add this to your Podfile
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