1:Xcode错误提示:Command CompileSwiftSources failed with a nonzero exit code
去target里面,如果报错在pod库里面,就去pod对应的target里面找build setting里面新增一条user-defined
SWIFT_ENABLE_BATCH_MODE并且标记为NO
2:xcode运行项目报错,pod的三方库中也需要一个个选择登录苹果账号
Signing for "***" requires a development team. Select a development team in the Signing & Capabilities editor.
//podfile文件添加
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["DEVELOPMENT_TEAM"] = "账号的ID"
end
end
end
end
3:xcode14.3移除了arc目录,报错
File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
linker command failed with exit code 1 (use -v to see invocation)
post_install do |installer|
#1:从旧的xcode复制ARC目录:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/
#2:podfile添加以下代码,target至少9.0
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
4:xcode14.3打包报错:
Command PhaseScriptExecution failed with a nonzero exit code
image.png
在xcode中找到pod工程下面targers support files目录,然后选中pod-项目名--frameworks.sh,在源码中搜索source="$(readlink "${source}")"
,替换成source="$(readlink -f "${source}")"
,然后重新Archive即可。
image.png
5:get请求报错
finished with error [-1103] Error Domain=NSURLErrorDomain Code=-1103 "资源大小超过了最大值"
ios13以后的系统,get请求的返参数据如果超过了14k,就会报这个错误
6:运行在iOS13系统以下的手机出现SwiftUI兼容性报错
解决方案一:Build Settings 选项卡中的 Other Linker Flags 设置里面添加 -weak_framework和SwiftUI
解决方案二:Build Phases选项卡中的 Link Binary With Libraries 里面添加 SwiftUI.framework,然后将Status改为Optional。