jhe*_*erg 54 ios cocoapods bitcode
如何为项目和cocoapod依赖项禁用bitcode?这是我在尝试使用Xcode 7运行项目时遇到的错误.
不包含bitcode.您必须在启用bitcode(Xcode设置ENABLE_BITCODE)的情况下重建它,从供应商处获取更新的库,或禁用此目标的bitcode.对于架构arm64
编辑:最初只为其中一个目标禁用它.一旦我禁用了所有这些,我就能够成功构建.
Kei*_*ley 146
要以每次执行时都不会被覆盖的方式设置此设置,pod install
您可以将其添加到您的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
Run Code Online (Sandbox Code Playgroud)
有一种方法可以用完整的bitcode构建CocoaPods的目标.只需添加每个-fembed-bitcode
选项OTHER_CFLAGS
:
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
Run Code Online (Sandbox Code Playgroud)
我认为这种方法比禁用bitcode更好.
要为您自己的开发 pod 禁用位代码,只需在项目的 pod 文件中添加以下代码。
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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
小智 5
除了@werediver 的回答:
如果您想启用位码,请在您的post_install
“我建议”设置中['ENABLE_BITCODE'] = 'YES'
。您还可以添加部署目标(以阻止 XCode 抱怨)。在这种情况下:['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
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
config.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
Run Code Online (Sandbox Code Playgroud)
如果您可以控制 .podspec (即使用自己的规范/git 存储库提供 pod)
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => '否' }
归档时间: |
|
查看次数: |
22021 次 |
最近记录: |