集成Google Places后iOS模拟器无法运行,arm64架构链接错误求助
iOS集成Google Places后模拟器运行报错arm64架构问题修复方案
报错详情
为iOS模拟器构建,但链接的是为iOS构建的目标文件,文件路径'/Users/davitmuradyan/Documents/DigiSoft/trip-share-ios/TripShare/Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.framework/GoogleMapsBase',架构为arm64
故障原因
该报错仅出现在苹果硅芯片Mac设备上,旧版Google Maps/Google Places SDK未提供适配苹果硅模拟器的arm64架构切片,仅包含iOS真机的arm64切片,因此构建模拟器版本时链接失败。
解决方案
方案1:正确配置排除arm64架构(适用于SDK版本低于7.0的情况)
之前配置不生效大概率是仅修改了主项目配置,未同步Pod项目配置,按以下步骤操作可永久生效:
- 打开项目的Podfile文件,在末尾添加如下自动配置代码:
post_install do |installer| # 配置Pods项目全局排除模拟器arm64架构 installer.pods_project.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end # 配置所有Pods子target排除模拟器arm64架构 installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end end end
- 保存Podfile后在项目根目录执行
pod install命令,自动更新所有配置
方案2:升级SDK版本(推荐)
Google Maps iOS SDK从v7.0版本开始已原生支持苹果硅模拟器arm64架构,无需额外配置即可正常运行:
- 修改Podfile中Google相关依赖的版本要求为最新稳定版
- 执行
pod update GoogleMaps GooglePlaces完成升级
生效验证
- 按
Command + Shift + K清理Xcode构建缓存 - 删除
~/Library/Developer/Xcode/DerivedData目录下对应项目的缓存文件夹 - 重启Xcode后重新构建运行模拟器即可
内容的提问来源于stack exchange,提问作者NoName555
相关产品推荐
相关产品推荐

