公司的一個老項(xiàng)目,在MacMini上build失敗雀费,要求升級Xcode干奢,于是升級了Xcode,之后如我所想盏袄,報錯忿峻。在MacMini上遠(yuǎn)程折騰了好幾個小時,不過沒想到最后是在m1上解決了辕羽。
下面記錄2個錯誤和解決(還是要會用搜索引擎)逛尚。
錯誤一:
/Users/a123/Library/Developer/Xcode/DerivedData/StoreApp-fwwfjzkqlgwsvgdugbsmhbnfwwhu/Build/Products/Release-iphoneos/AFNetworking-iOS11.0/AFNetworking.framework/AFNetworking' 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. file '/Users/a123/Library/Developer/Xcode/DerivedData/StoreApp-fwwfjzkqlgwsvgdugbsmhbnfwwhu/Build/Products/Release-iphoneos/AFNetworking-iOS11.0/AFNetworking.framework/AFNetworking' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation
錯誤解釋:AFNetworking這個做網(wǎng)絡(luò)請求不支持bitcode,提示讓這個庫開啟bitcode刁愿,或者在target里關(guān)閉bitcode绰寞。
查資料得知Xcode14中放棄了bitcode,iOS 9酌毡、iOS 10克握,最小支持iOS 11,所以:
第一步:設(shè)置iOS Development Target
: 11.0
第二步:
嘗試一枷踏,升級AFNetworking菩暗,使用支持bitcode的庫。
很遺憾旭蠕,AFNetworking最新版本4.0.1與停团,我們項(xiàng)目里使用的4.0一樣旷坦,此路不通。
嘗試二佑稠,按照提示關(guān)閉bitcode
具體在target --> Built Seeting -->搜索 ENABLE_BITCODE --->將Yes置為No秒梅。
結(jié)論
嘗試二成功。
下面的方式應(yīng)該更加推薦舌胶,但是我嘗試沒有成功捆蜀,理論上肯定能成功的,只是沒有再試幔嫂。
還是按照上面的關(guān)閉辆它,只是在Podfile中修改
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
end
錯誤二:
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
解決方法
在Xcode項(xiàng)目目錄中進(jìn)入 Pods -> Targets Support Files -> Pods-項(xiàng)目名 -> Pods-項(xiàng)目名-frameworks.sh 中搜索source="$(readlink "${source}")"
,找到后將其替換為source="$(readlink -f "${source}")"
履恩,然后重新進(jìn)行打包操作锰茉。
這貌似是Cocoapods的問題??。
參考鏈接
AFNetworking was built without full bitcode
Xcode14 正式版編譯報錯‘ does not contain bitcode.解決方案
升級Xcode14.3后打包報錯Command PhaseScriptExecution failed with a nonzero exit code