解决项目真机上可运行,模拟器上不行,并出现以下错误:
..., building for iOS Simulator, but linking in object file built for iOS, file '...'
could not find module for target 'x86_64-apple-ios-simulator'
解决方案一
1.添加arm64
到项目PEROJECT
和TARGETS
的Excluded Architectures
中
路径1:PEROJECT
- Build Settings
- Excluded Architectures
路径2:TARGETS
- Build Settings
- Excluded Architectures
2.在项目的podfile的最后添加以下代码
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
3.clean项目,最后终端pod install下,重新运行项目就能在模拟器运行了
注意:之后如需在真机上运行则需把上面第一步和第二步恢复原状,然后pod install一下。(在上架App Store前也需这样做)
解决方案二