xcode 在 iPhone 上运行 Ionic 3 应用程序会引发错误:架构 arm64 的 2 个重复符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46173762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:13:56  来源:igfitidea点击:

Running Ionic 3 app on iPhone throws error: 2 duplicate symbols for architecture arm64

xcodecordovaionic-frameworkcordova-pluginsionic3

提问by Manuel RODRIGUEZ

I am opening .xcworkspaceof my Ionic 3 project and trying to run it on my device but I suddenly get the following error in Xcode:

我正在打开.xcworkspace我的 Ionic 3 项目并尝试在我的设备上运行它,但我突然在 Xcode 中收到以下错误:

Ld /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/MyApp.app/MyApp normal arm64
    cd /Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -L/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -L/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/MyApp/Plugins/cordova-plugin-google-analytics -F/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -F/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -FMyApp/Plugins/com.googlemaps.ios -filelist /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -framework OneSignal -framework SystemConfiguration -framework UIKit -framework UserNotifications /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a -framework Accelerate -framework CoreData -framework CoreLocation -framework CoreText -framework GLKit -framework ImageIO -lc++ -lz -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -framework GoogleMapsBase -framework GoogleMaps -framework GoogleMapsCore -framework EventKit -framework EventKitUI -framework AVFoundation -lGoogleAnalyticsServices -lAdIdAccess -framework AdSupport -lsqlite3 -weak_framework WebKit -lz -Xlinker -dependency_info -Xlinker /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp_dependency_info.dat -o /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/MyApp.app/MyApp

duplicate symbol _OBJC_CLASS_$_CDVLogger in:
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/CDVLogger.o
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/CDVLogger.o
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't understand what is duplicated... any help would be really appreciated.

我不明白什么是重复的......任何帮助将不胜感激。

回答by Ionut Movila

To solve the problem please have a look over this blog post from Cordova iOS 4.5. http://cordova.apache.org/announcements/2017/09/08/ios-release.html

要解决这个问题,请查看 Cordova iOS 4.5 的这篇博文。 http://cordova.apache.org/announcements/2017/09/08/ios-release.html

You need to remove plugin "cordova-plugin-console" that is installed by default when generating a new Ionic project. Now this is in core part of cordova for iOS.

您需要删除生成新 Ionic 项目时默认安装的插件“cordova-plugin-console”。现在这是 iOS 版cordova 的核心部分。

回答by arunraj414

Since duplicate symbols are there, just removed "-ObjC" from both Targets and Project:

由于存在重复符号,只需从目标和项目中删除“-ObjC”:

Build Settings -> Linking -> Other linker flags.

构建设置 -> 链接 -> 其他链接器标志。

also try to remove any unwanted libraries from

还尝试从中删除任何不需要的库

Targets -> Build Phases -> Link Binary with Libraries

目标 -> 构建阶段 -> 将二进制文件与库链接

回答by FlorentGui

The problem here is cordova-ios@latest.

这里的问题是cordova-ios@latest。

And we could fixed this issues with:

我们可以通过以下方式解决这个问题:

  • Uninstall cordova-ios first, with npm uninstall cordova-ios
  • Install cordova-ios with npm install [email protected]
  • After that we should add platform with ionic cordova platform add [email protected]
  • The last one, run ionic cordova build ios, that open with xcode and build with your settings.
  • 首先卸载cordova-ios,使用 npm uninstall cordova-ios
  • 安装cordova-ios npm install [email protected]
  • 之后我们应该添加平台 ionic cordova platform add [email protected]
  • 最后一个 run ionic cordova build ios,用 xcode 打开并用你的设置构建。

回答by Cleber Albuquerque

Since cordova IOS 4.5 they are including cordova-plugin-console, which results in the plugin being duplicated.
To fix just run:

从cordova IOS 4.5开始,它们包含cordova-plugin-console,这会导致插件被复制。
要修复只需运行:

cordova plugin rm cordova-plugin-console