M1 運行的報錯
Library not found for -lPods-xxxx_Example
Undefined symbols for architecture x86_64:
如果你項目在M1 設備上打不開,那么你需要在項目里面設置一下
選擇項目,TARGETS->當前TARGET->Build Settings->Architectures->Excluded Architectures->Debug 添加Any iOS Simulator SDK 值arm64

需要修改的內容
如果你是模塊化開發(fā).或者pod中的第三方庫運行M1也報錯.那么你也需要將你的pod中的第三方庫也要修改為arm64
在podfile中添加下面代碼
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end
如果你在podfile中設置了第三方為project方式管理代碼,那么你需要用下面的方式
platform :ios, '9.0'
# 設置project管理方式
install! 'cocoapods',
:generate_multiple_pod_projects => true
post_install do |installer|
installer.pod_target_subprojects.flat_map { |p| p.targets }.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end
設置完成后pod install一下(可以先將pod庫中文件先刪除)
如果有提示XCTest.framework報錯.可以先將其刪除