体系结构的未定义符号 x86_64:“_OBJC_METACLASS_$_GMVDetector”引用自:TextDetector

Undefined symbols for architecture x86_64: "_OBJC_METACLASS_$_GMVDetector" referenced from: TextDetector

我在没有 cocoapods 的情况下将 Google Firebase MLKit 添加到我的项目中。当我尝试构建时,出现 Undefined symbol 错误:Xcode error image

Undefined symbols for architecture armv7:
  "_OBJC_METACLASS_$_GMVDetector", referenced from:
      l45918 in TextDetector
  "_OBJC_CLASS_$_GMVDetector", referenced from:
      l45917 in TextDetector
  "_OBJC_CLASS_$_GMVFeature", referenced from:
      _OBJC_CLASS_$_GMVTextBlockFeature in TextDetector
      _OBJC_CLASS_$_GMVTextLineFeature in TextDetector
      _OBJC_CLASS_$_GMVTextElementFeature in TextDetector
  "_OBJC_METACLASS_$_GMVFeature", referenced from:
      l45914 in TextDetector
      l45915 in TextDetector
      l45916 in TextDetector
  "_OBJC_CLASS_$_GMVUtility", referenced from:
      objc-class-ref in TextDetector
  "_OBJC_CLASS_$_GMVLogger", referenced from:
      objc-class-ref in TextDetector
  "_GMVFeatureTypeTextLine", referenced from:
      l31298 in TextDetector
  "_GMVDetectorImageOrientation", referenced from:
      l31341 in TextDetector
      l31342 in TextDetector
  "_GMVFeatureTypeTextElement", referenced from:
      l31313 in TextDetector
  "_GMVFeatureTypeTextBlock", referenced from:
      l31279 in TextDetector
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

到目前为止我已经试过了:

  1. 退出 Xcode 然后清理构建
  2. 手动和拖放框架
  3. 链接了所有需要的资源文件夹
  4. 正在删除 Xcode 个临时文件
  5. Build Settings 下的 symbols hidden by default 设置为 No 尽管框架 TextDetector 链接到正确的目标。

所有这些似乎都不起作用。我按照 Integrate without CocoaPods 进行了框架设置。

Project Structure Image and Architecture in Build Settings

已解决。我在上面提到的 Firebase link 中添加了所有其他框架,这些框架与 .zip 文件一起出现。 List of Frameworks。这不是一个简单的设置,readme 和网站中均未提及。可能所有这些框架都不是必需的,但许多是相互依赖的,因为它们在每个框架的 module.modulemap 中指定。