我正在使用 React Native 构建一个应用程序,我已经“弹出”到它自己的 iOS 原生应用程序项目中。我有兴趣使用新的 Firebase ML Kit Vision Text Detector 来使用设备上模型识别图像中的文本,并且我愿意为它编写自己的 NativeModule 包装器(因为它太新了,我看不到react-native-firebase 等项目中的任何现有包装器)。
因此,我使用 Cocoapods 引入了 Firebase 依赖项,但是当我尝试编译新工作区时,出现以下链接器错误:
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
从我读到的关于 React Native 项目中重复符号错误的其他案例中,这通常是由于除了将 React 项目手动链接到主应用程序项目之外,还包括依赖于 React 的 pod(因为它最初是设置的)弹出后,以及使用react-native link
) 链接的其他库。但是,这里不是这种情况——我通过 podfile 引入的唯一库是与 Firebase 相关的,所以我不确定冲突是如何发生的。
任何人的任何见解——也许来自致力于 iOS 新机器学习套件的 Firebase 团队?请注意,我什至还没有编写任何引用框架的代码,我只是试图让工作区配置进行编译。这是 podfile 供参考:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.3'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for App
pod 'Firebase/Core'
pod 'Firebase/MLVision'
pod 'Firebase/MLVisionTextModel'
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
这是主应用程序项目中所有链接库项目的屏幕截图: