Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

duplicate symbol _RCTRemoteNotificationReceived

Tags:

duplicates

I am not able to resolve this issue from so long please do help me anyone..

Apple Mach-O Linker (Id) Error

Linker command failed with exit code 1 (use -v to see invocation)   

Ld /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify- bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/newNotify.app/newNotify normal arm64
cd /Users/anubhavpilania/newNotify/ios
export IPHONEOS_DEPLOYMENT_TARGET=11.4
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/iPhoneOS11.4.sdk -
L/Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos -F/Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef
/Build/Products/Debug-iphoneos -filelist /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Intermediates.noindex/newNotify.build/Debug-iphoneos/newNotify.build/Objects-normal/arm64/newNotify.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=11.4 -Xlinker -object_path_lto -Xlinker /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Intermediates.noindex/newNotify.build/Debug-iphoneos/newNotify.build/Objects-normal/arm64/newNotify_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -lc++ -ObjC /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTPushNotification.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTBlob.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTAzureNotificationHubManager.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libWindowsAzureMessaging.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTAnimation.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libReact.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTActionSheet.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTGeolocation.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTImage.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTLinking.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTNetwork.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTSettings.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTText.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTVibration.a /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTWebSocket.a -Xlinker -dependency_info -Xlinker /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Intermediates.noindex/newNotify.build/Debug-iphoneos/newNotify.build/Objects-normal/arm64/newNotify_dependency_info.dat -o /Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/newNotify.app/newNotify

 duplicate symbol _RCTRemoteNotificationReceived in:
/Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTPushNotification.a(RCTPushNotificationManager.o)
/Users/anubhavpilania/Library/Developer/Xcode/DerivedData/newNotify-bcawjuyeqhqkypfnultgtirfnbef/Build/Products/Debug-iphoneos/libRCTAzureNotificationHubManager.a(RCTAzureNotificationHubManager.o)

ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
like image 632
Anubhav Pilania Avatar asked Jun 26 '18 12:06

Anubhav Pilania


Video Answer


2 Answers

In my case this issue occurred when I switched from PushNotificationIOS provided with the React Native core to the extracted version from @react-native-community/push-notification-ios. (Around version RN 0.60)

After linking the new library and installing the CocoaPods dependencies of the iOS project this issue started popping up.

For some reason while setting up the core RN Push Notification library I manually added libRCTPushNotification.a to the "Linked Frameworks and Libraries" of my project. Removing this reference to the core library resolved the issue and let me compile again.

like image 125
padarom Avatar answered Sep 27 '22 23:09

padarom


The PushNotificationIOS was split out from the core React Native. So this issue comes up when migrating to the new module @react-native-community/push-notification-ios.

To fix this, just remove or comment out the PushNotificationIOS library from the Podfile: ./ios/Podfile pod 'React-RCTPushNotification', :path => '../node_modules/react- native/Libraries/PushNotificationIOS'

Then, run the following commands: rm -rf Pods pod install

Rebuild and then run your project.

like image 22
Brice Nguessan Avatar answered Sep 27 '22 21:09

Brice Nguessan