简体   繁体   English

为iOS构建后出现Ionic应用链接器错误

[英]Ionic app linker errors after building for iOS

I am developing an app using the Ionic 4 framework and am currently attempting to build it for iOS and release it to the App Store. 我正在使用Ionic 4框架开发应用程序,目前正在尝试为iOS构建它并将其发布到App Store。 The error I am getting is when I attempt to run the app in Xcode, it will fail in the linking phase with the following error: 我遇到的错误是当我尝试在Xcode中运行应用程序时,它将在链接阶段失败,并显示以下错误:

ld: 346 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation). ld:346 x86_64体系结构的重复符号clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)。

This is preceded by a list of the duplicate symbols like so: 这之前是重复符号的列表,如下所示:

duplicate symbol _OBJC_IVAR_$_FIRInstanceIDURLQueryItem._name in: /Users/james/Library/Developer/Xcode/DerivedData/Jambox-ataoinheliizvyaczvbklhkqvhpf/Build/Products/Debug-iphonesimulator/FirebaseInstanceID/libFirebaseInstanceID.a(FIRInstanceIDURLQueryItem.o) Jambox/Plugins/cordova-plugin-firebase/FirebaseInstanceID.framework/FirebaseInstanceID(FIRInstanceIDURLQueryItem_ce817fff617a4255d51c2a25da32a1f0.o) /Users/james/Library/Developer/Xcode/DerivedData/Jambox-ataoinheliizvyaczvbkhkqvhpf/Build/Products/Debug-iphonesimulator/FirebaseInstanceID/libFirebaseInstanceIDs.URL(P/PluginInstanceID)中的重复符号_OBJC_IVAR _ $ _ FIRInstanceIDURLQueryItem._name。 plugin-firebase / FirebaseInstanceID.framework / FirebaseInstanceID(FIRInstanceIDURLQueryItem_ce817fff617a4255d51c2a25da32a1f0.o)

These are relating to the following frameworks: 这些与以下框架有关:

  • FirebaseInstanceID.framework FirebaseInstanceID.framework
  • GoogleUtilities.framework GoogleUtilities.framework

  • nanopb.framework 纳米铅框架

  • FirebaseCore.framework FirebaseCore.framework

I have tried a few solutions to this problem, but none result in success: 我已经尝试了一些解决此问题的方法,但没有一个能成功:

1). 1)。 Removing -ObjC and $(inherited) from Other Linker Flags - this causes the app to build and link successfully, but crash on startup with this error: 从其他链接器标记中删除-ObjC和$(继承)-这将导致应用程序成功构建和链接,但在启动时因以下错误而崩溃:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRApp registerAsConfigurable:]: unrecognized selector sent to class 0x1080bc178' ***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'+ [FIRApp registerAsConfigurable:]:无法识别的选择器发送到类0x1080bc178'

2). 2)。 Removing each framework in the list of duplicate symbols - this helps in lowering the number of duplicate symbols. 删除重复符号列表中的每个框架-这有助于减少重复符号的数量。 I can get it down to 65 duplicate symbols until I have to remove GoogleUtilities.framework, which causes the build the fail with this error: 我可以将其减少到65个重复的符号,直到必须删除GoogleUtilities.framework,这会导致构建失败并出现以下错误:

Undefined symbols for architecture x86_64: 架构x86_64的未定义符号:
"_OBJC_CLASS_$_GULObjectSwizzler", referenced from: objc-class-ref in FirebasePerformance(FPRObjectInstrumentor_f65d32035cadef24185912716f0b12f9.o) objc-class-ref in FirebasePerformance(FPRNetworkTrace_3053ec2ab59f2fcfec4b18c29e4b4cec.o) objc-class-ref in FirebasePerformance(FPRNSURLConnectionInstrument_5611d225f62417fa73742554b6a45401.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) “_OBJC_CLASS _ $ _ GULObjectSwizzler”,从引用:在FirebasePerformance(FPRObjectInstrumentor_f65d32035cadef24185912716f0b12f9.o)objc级-REF objc级-REF在FirebasePerformance(FPRNetworkTrace_3053ec2ab59f2fcfec4b18c29e4b4cec.o)objc级-REF在FirebasePerformance(FPRNSURLConnectionInstrument_5611d225f62417fa73742554b6a45401.o)LD:符号(S )找不到架构x86_64 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

3). 3)。 Deleting DerivedData folder - I get the same errors after doing this. 删除DerivedData文件夹-执行此操作后出现相同的错误。

4). 4)。 Removing and adding the iOS platform - Same errors. 删除和添加iOS平台-相同的错误。

In my case, this problem arose when using phonegap-plugin-push and cordova-plugin-firebase-analytics together. 就我而言,当同时使用phonegap-plugin-push和cordova-plugin-firebase-analytics时,就会出现此问题。 I found the fix in this issue thread . 我在此问题线程中找到了解决方法。

Basically, go to your Project Navigator in Xcode, then 'Build Phases', expand 'Link Binary With Libraries', click '+' and Add 'libGoogleToolboxForMac.a' and 'libPodsYourProjectName.a' and redo the build. 基本上,使用Xcode转到项目导航器,然后单击“构建阶段”,展开“使用库链接二进制文件”,单击“ +”并添加“ libGoogleToolboxForMac.a”和“ libPodsYourProjectName.a”,然后重做构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM