Ionic app linker errors after building for iOS - 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. 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:
ld: 346 duplicate symbols for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation).
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)
These are relating to the following frameworks:
FirebaseInstanceID.framework
GoogleUtilities.framework
nanopb.framework
FirebaseCore.framework
I have tried a few solutions to this problem, but none result in success:
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:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRApp
registerAsConfigurable:]: unrecognized selector sent to class
0x1080bc178'
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:
Undefined symbols for architecture 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)
3). Deleting DerivedData folder - I get the same errors after doing this.
4). Removing and adding the iOS platform - Same errors.

In my case, this problem arose when using phonegap-plugin-push and cordova-plugin-firebase-analytics together. 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.

Related

After Deleting storyboard file in Objective C I got following error message in XCode 11.5

I created a storyboard while I developing ios project in XCode. Then I delete it. When I delete it there asked Remove Reference or Move to Trash as following screenshot.
There I clikcked Remove Reference. After that I got Following Errors in my Objective C project.
Undefined Symbol:
and
Undefined symbols for architecture arm64:
"_openTransactionsMultiVC_SID", referenced from:
-[ReceiptMailViewController okBack:] in ReceiptMailViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
See Following image for more clear

xcode build fails with : "_RCTSetLogFunction", referenced from: -[AppTests testRendersWelcomeScreen] in AppTests.o

After upgrade xcode to 10.1 the project's compile fails with :
ld: warning: directory not found for option '-L/Users/divanov/Desktop/<projectName> AppTests'
Undefined symbols for architecture arm64:
"_RCTSetLogFunction", referenced from:
-[AppTests testRendersWelcomeScreen] in AppTests.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The following work around worked for me:
in XCode select the project in the left panel
Click on "Build Settings"
In the "Linking" section, find"Dead Code Stripping" section and change it "No"
Clean and Build
*** In another project I got the same error but in that case the libraries were missing in "Settings of the failing Target"/"Build Phases"/"Link Binary With", so I had to add them manually!

Unity xCode Linker error - Trying to Debug

Trying to figure out how to even start debugging this issue. I'm using Google VR on Unity, deploying to xcode for the build to iOS devices. I"ve opened the workspace instead of the project in xcode as referenced in:
Xcode Project vs. Xcode Workspace - Differences
I've attempted to fix as referenced in:
Duplicate Symbols for Architecture arm64
Still getting the same error and have no idea where to go from here.
duplicate symbol _OBJC_CLASS_$_DeviceParamsSyncHelper in:
/Users/OriginDevIT/Documents/ODIT_ARVR/GP_Excel/builds/ios/V1.9.11.b11/Pods/GVRSDK/Libraries/libGVRSDK.a(DeviceParamsSyncHelper.mm.o)
/Users/OriginDevIT/Documents/ODIT_ARVR/GP_Excel/builds/ios/V1.9.11.b11/Libraries/Plugins/iOS/libgvrunity.a(DeviceParamsSyncHelper.mm.o)
duplicate symbol _OBJC_METACLASS_$_DeviceParamsSyncHelper in:
/Users/OriginDevIT/Documents/ODIT_ARVR/GP_Excel/builds/ios/V1.9.11.b11/Pods/GVRSDK/Libraries/libGVRSDK.a(DeviceParamsSyncHelper.mm.o)
/Users/OriginDevIT/Documents/ODIT_ARVR/GP_Excel/builds/ios/V1.9.11.b11/Libraries/Plugins/iOS/libgvrunity.a(DeviceParamsSyncHelper.mm.o)
ld: 2087 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

cocoapods linker error when i added it to my project

i'm using cocoapods for the first time and after everything goes well
i get to run my project that was always wor˚ and got those 2 errors in lin˚er
can anyone please tell me what is it
than˚s
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_PECropViewController", referenced from:
objc-class-ref in addProductViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The addProductViewController object is not found and it was referenced within AppDelegate. You do not link addProductViewController into your app. Check if your Compile Sources section within the Build Phases of your project shows addProductViewController.m
than˚s every body for your help
the problem was with arm 64 i just added it in my target and everything work fine
in architectures filed add standard architectures armv7,arm64

Apple Mach-O Linker Error during profile

So I ran into this wierd issue where I am able to compile and run my iOS project in simulator with out any issues but when I ran it for profiling with instrument (cmd + I) I am getting Apple mach o linker error for one of the library. I tried it reading to project but it did not helped. I also checked my search paths which looks as following
Other Linker Flags: -ObjC -all_load
Always Search User Paths: No
Framework Search Paths:$(SRCROOT) recursive
Library Search Paths:$(SRCROOT) recursive
I am getting following error message:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_TestFlight", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Am I missing anything in my linking phase which causing this thing to happen ?
It's not finding the TestFlight library. Easiest way to fix that is to find libTestFlight.a in the Xcode project browser and make sure your app is checked under "Target Membership" on the far right pane.

Resources