无法使用Firebase ML Kit视觉文本检测器编译iOS React Native应用

时间:2018-06-21 20:59:26

标签: ios firebase react-native firebase-mlkit

我正在使用React Native构建一个应用程序,该应用程序已经“弹出”到其自己的iOS本地应用程序项目中。我对使用新的Firebase ML Kit视觉文本检测器以使用设备上模型识别图像中的文本感兴趣,并且我愿意为此编写自己的NativeModule包装器(因为它是如此新增,我在诸如react-native-firebase之类的项目中看不到任何现有的包装器。

因此,我使用Cocoapods引入了Firebase依赖项,但是当我尝试编译新工作区时,出现以下链接器错误:

return this.text.replace(new RegExp('0d0a') ,  ' ')

根据我对React Native项目中其他重复符号错误情况的了解,这通常是由于除了手动将React项目链接到主应用程序项目之外,还包括依赖于React的Pod。最初是在弹出后与使用duplicate symbol __ZN3fLB28FLAGS_nosymbolize_stacktraceE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o) duplicate symbol __ZN3fLB26FLAGS_symbolize_stacktraceE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o) duplicate symbol __ZN3fLI9FLAGS_novE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o) duplicate symbol __ZN3fLI7FLAGS_vE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o) duplicate symbol __ZN3fLS13FLAGS_vmoduleE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o) duplicate symbol __ZN3fLB18FLAGS_nolog_prefixE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(logging.o) duplicate symbol __ZN3fLB16FLAGS_log_prefixE in: /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o) /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(logging.o) ld: 7 duplicate symbols for architecture x86_64 链接的其他库一起设置的。但是,事实并非如此-我要通过Podfile插入的唯一库与Firebase相关,所以我不确定冲突如何发生。

任何人的见解-也许是Firebase团队正在为iOS开发新的ML Kit?请注意,我什至还没有编写任何引用框架的代码,我只是想让工作区配置得以编译。这是Podfile供参考:

react-native link

这是主应用程序项目中所有链接库项目的屏幕截图:

Previously linked project dependencies

1 个答案:

答案 0 :(得分:4)

将ML套件应用于RN项目时,我遇到了同样的问题。解决方法如下:

  

选择主要目标>构建设置>死剥离代码=是

希望它能使您成功。