20

I am opening .xcworkspace of my Ionic 3 project and trying to run it on my device but I suddenly get the following error in 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.

Manuel RODRIGUEZ
  • 2,031
  • 3
  • 22
  • 51

5 Answers5

57

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

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.

Ionut Movila
  • 586
  • 4
  • 2
  • this is it after like running around in circles – momoterraw Oct 15 '17 at 22:10
  • 2
    in case anyone's wondering how to remove plugin : cordova plugin remove FOLDER_PLUGIN_NAME – sanedroid Oct 23 '17 at 10:38
  • I. Love. You. If you create a religion or a sect I'll be the more fanatic of your followers. Thank you, thank you, thank you, thank you!! Which I could upvote you twice. – Dev Nov 08 '17 at 08:36
  • I had same problem and I tried to remove cordova-plugin-console. I can deploy on iOS device now, but my app crash and I have this error : "Thread 1: signal SIGABRT". I don't know why ... – V. Pivet Nov 15 '17 at 13:12
  • You're a life saver!! – casper123 Dec 11 '17 at 08:40
  • Thanks a lot, after hours of searching for a solution, this actually worked! – Davey Hoogland Jul 28 '18 at 22:12
  • works like a charm. For more information, we can remove plugin like this article https://stackoverflow.com/questions/49103543/how-to-remove-installed-ionic-cordova-plugin-from-ionic-2-3-or-ionic-v2-proje – nttrung143 Jan 17 '19 at 15:22
15

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

Build Settings -> Linking -> Other linker flags.

also try to remove any unwanted libraries from

Targets -> Build Phases -> Link Binary with Libraries

arunraj770
  • 607
  • 1
  • 8
  • 25
  • Thank you so much for this answer. I tried everything so far! Nothing worked except for this. Thanks again – Nearpoint Oct 05 '17 at 21:18
  • This answer is working if you are using old cordova versions.Many thanks – Fatih Ayyildiz Oct 11 '17 at 13:53
  • As an Obj-C developer your process was my gut-sense but since we are using ionic for this project it is logically correct process was to remove the duplicate via cordova. – Jacksonkr Feb 01 '19 at 19:44
10

The problem here is 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 cordova-ios@4.4.0
  • After that we should add platform with ionic cordova platform add ios@4.4.0
  • The last one, run ionic cordova build ios, that open with xcode and build with your settings.
djejaquino
  • 162
  • 1
  • 7
FlorentGui
  • 113
  • 7
6

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

cordova plugin rm cordova-plugin-console
0

The solution @arunraj414 worked for me, from xcode you can solve it this way:

enter image description here

Delete either one

Santiago Vasquez
  • 127
  • 1
  • 10