• XCode编译报错:Error (Xcode): File not found
  • 发布于 2个月前
  • 168 热度
    0 评论
  • 久就旧
  • 0 粉丝 25 篇博客
  •   
错误描述
Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)


分析

libarclite_iphonesimulator.a 这个文件是 ARC 自动释放内存的功能。引起的问题是你的项目很新,但是编译目标太老,然后呢,没有这个文件。你需要把这个文件复制到 .../arc/ 目录下。还有一个办法直接修改 IPHONEOS_DEPLOYMENT_TARGET 编译目标为 ios 11,就好了。这只对新项目有效。

解决
代码方式
ios/Podfile
批量修改所有的依赖项目标版本号
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    # 堆代码 duidaima.com
    # add 修改项目配置
    if target.platform_name == :ios
      target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' # 将11.0替换为您需要的目标版本号
      end
    end
    # add end

  end
end
执行命令
$ cd ios
$ pod update

手动方式
手动修改每个依赖包的部署最小版本为 ios 11.0

可能遇到的问题
[!] Invalid Podfile file: [!] Specifying multiple post_install hooks is unsupported
这个错误意味着您在 Podfile 文件中指定了多个 post_install 钩子,而 CocoaPods 不支持这种做法。要解决这个问题,您需要将多个 post_install 钩子合并为一个。
用户评论