当我在iOS Flutter中构建发布版本时,出现了这个错误。

3

在 Xcode 中构建/归档此 Flutter 项目时,我遇到了以下错误。

ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/GoogleAPIClientForREST'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/GoogleToolboxForMac'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/Protobuf'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/firebase_ml_vision'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/flutter_native_image'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/image_picker'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/nanopb'
ld: warning: directory not found for option '-L/Users/gurleensethi/FlutterProjects/camera_ml/build/ios/Debug-iphoneos/path_provider'
ld: library not found for -lFirebaseCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
3个回答

3

我遇到了类似的问题,而对我来说,问题是由于在 XCode 中打开 Runner.xcodeproj 而不是 Runner.xcodeworkspace 导致的。对于有经验的 XCode 用户来说,这可能很明显,但也许这会帮助某个人解决问题。


1

看起来您缺少库,请尝试:

  1. flutter clean
  2. flutter build ios

已经尝试过多次,但没有成功! - Gurleen Sethi
我认为这句话的意思是找不到构建文件夹,请尝试运行 flutter build ios,然后再使用 Xcode 运行。 - khairy Mohamed
这是关于Firebase的事情,但我无法弄清楚! - Gurleen Sethi

0

我花了几个小时来解决一个类似的库未找到的错误。最终,这是我解决它的方法:

  1. 在开始使用Xcode Archive之前,先使用flutter build iOS
  2. 将IOS Deployment Target更改为更高的目标iOS 11.2。之前我有类似8.0的东西,导致出现以上所有错误。
  3. 确保Xcode中的IOS deployment targets在项目、目标和Pods中相同

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接