1摆出、Xcode升級到14后疯坤,編譯報錯:
Signing for "xxx" requires a development team. select a development team in the signing & capabilities editor
該錯誤為Pod庫中包含Test的Target诉稍,需要設(shè)置Team ID
解決方案①:針對報錯的庫曾雕,手動選擇簽名的 Team
解決方案②:在Podfile 中添加一下代碼踏施,dev_team的值為開發(fā)者賬號的 Team ID叮叹,
post_install do |installer|
? dev_team = “xxxxxxxxxxx"
?????project = installer.aggregate_targets[0].user_project
?????project.targets.each do |target|
?????????target.build_configurations.each do |config|
?????????????if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
?????????????????dev_team = config.build_settings['DEVELOPMENT_TEAM']
?????????????end
?????????end
end
2问畅、
撥錯信息?ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
從報錯信息看娃属,都是在鏈接庫的時候因?yàn)檎也坏届o態(tài)庫(libarclite_iphonesimulator.a/libarclite_iphoneos.a)而報錯。利用訪達(dá)的前往文件夾功能快速來到報錯信息中的目錄护姆,發(fā)現(xiàn)連arc目錄都不存在矾端,更不用說靜態(tài)庫文件。
現(xiàn)在可以確定的是Xcode 14.2版本肯定是正常的卵皂,那會不會是14.3版本移除了整個arc目錄秩铆?找到一臺還沒升級到Xcode 14.3版本的電腦,在同樣的路徑下灯变,果然存在arc目錄殴玛,
因?yàn)橄到y(tǒng)已經(jīng)內(nèi)置有ARC相關(guān)的庫,所以沒必要再額外鏈接添祸,至少Xcode 14支持的最低部署目標(biāo)iOS 11及以上版本的系統(tǒng)肯定是沒問題的滚粟。如果應(yīng)用部署目標(biāo)不低于iOS 11還出現(xiàn)問題,那么應(yīng)該是第三方庫的部署目標(biāo)有問題刃泌。
現(xiàn)在Xcode 14.3移除arc目錄的原因已經(jīng)很清楚凡壤,是因?yàn)橹С值淖畹筒渴鸢姹镜南到y(tǒng)都已經(jīng)內(nèi)置了ARC相關(guān)的庫署尤。如果應(yīng)用最低部署目標(biāo)版本本身不低于iOS 11,解決這個問題很簡單亚侠,只需要將第三方庫部署目標(biāo)的iOS版本設(shè)置成和應(yīng)用最低部署目標(biāo)的iOS版本一致曹体。
解決方案①: arc文件下載的鏈接: https://pan.baidu.com/s/1MI6Mr-gqOO6Yg_P9B5jpPg 密碼: 6ows
把a(bǔ)rc的文件復(fù)制到指定目錄路徑:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
解決方案②:設(shè)置第三方庫最低可運(yùn)行的系統(tǒng)版本,在Podfile 中添加一下代碼盖奈,并執(zhí)行pod install 命令
post_install do |installer|
??installer.pods_project.targets.each do |target|
????target.build_configurations.each do |config|
??????config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ‘11.0'
????end
??end
end
3混坞、
報錯信息PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-0CE87C2C48C36989195F6D5E.sh (in target 'Runner' from project 'Runner')
????cd /Users/shelly/Desktop/JA/qns_partner/ios
????/bin/sh -c /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-0CE87C2C48C36989195F6D5E.sh
mkdir -p /Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AliyunOSSiOS.framework" "/Users/shelly/Library/Developer/Xcode/DerivedData/Runner-hkpcetbkrwprnodvpnzwwzwyjxks/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks"
building file list ... rsync: link_stat "/Users/shelly/Desktop/JA/qns_partner/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AliyunOSSiOS.framework" failed: No such file or directory (2)
done
sent 29 bytes??received 20 bytes??98.00 bytes/sec
total size is 0??speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
解決方案①:手動修改,修改 /Pods/Target Support Files/Pods-{product名稱}/Pods-{product名稱}-frameworks.sh钢坦,搜索source="$(readlink "${source}")” ?并改為?????source="$(readlink -f "${source}”)"
解決方案②:在Podfile中添加一下代碼究孕,并執(zhí)行pod install 命令
post_install do |installer|
??installer.pods_project.targets.each do |target|
????shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
????if File::exists?(shell_script_path)
??????shell_script_input_lines = File.readlines(shell_script_path)
??????shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
??????File.open(shell_script_path, 'w') do |f|
????????shell_script_output_lines.each do |line|
??????????f.write line
????????end
??????end
????end
??end
end
針對Xcode 升級中的問題可以在Podfile中添加一下代碼統(tǒng)一處理,dev_team 修改成自己的TeamID 爹凹,并執(zhí)行pod install 命令厨诸,
post_install do |installer|
? dev_team = “xxxxxx"
?????project = installer.aggregate_targets[0].user_project
?????project.targets.each do |target|
?????????target.build_configurations.each do |config|
?????????????if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
?????????????????dev_team = config.build_settings['DEVELOPMENT_TEAM']
?????????????end
?????????end
??installer.pods_project.targets.each do |target|
????if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
????????target.build_configurations.each do |config|
????????????config.build_settings['DEVELOPMENT_TEAM'] = dev_team
????????end
??????end
????shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
???????if File::exists?(shell_script_path)
?????????shell_script_input_lines = File.readlines(shell_script_path)
?????????shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
?????????File.open(shell_script_path, 'w') do |f|
???????????shell_script_output_lines.each do |line|
?????????????f.write line
???????????end
?????????end
???????end
????flutter_additional_ios_build_settings(target)
????target.build_configurations.each do |config|
??????config.build_settings['ENABLE_BITCODE'] = 'NO'
??????config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
??????end
????end
??end
end
TeamID 的獲取方法
TeamID的獲取網(wǎng)站https://developer.apple.com/account
下圖中紅色框出來的區(qū)域?yàn)門eamID