GoogleApisForiOSComponents icon indicating copy to clipboard operation
GoogleApisForiOSComponents copied to clipboard

Linker Error when adding Xamarin.Firebase.iOS.RemoteConfig(4.2.1.1) to Xamarin Forms

Open DavePilks opened this issue 5 years ago • 26 comments

I have created a new Xamarin Forms project and added the Xamarin.Firebase.iOS.RemoteConfig nuget package (version 4.2.1.1) to the iOS project.

I then add the following line to the FinishedLaunching method in AppDelegate.

Firebase.Core.App.Configure();

I have also added the GoogleService-Info.plist which was downloaded from the Firebase Console.

Normally I would expect that, this simple setup to compile and run yet it produces the following linker error

MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FIRInstanceID. The symbol 'OBJC_CLASS$_FIRInstanceID' could not be found in any of the libraries or frameworks linked with your application. clang : error : linker command failed with exit code 1 (use -v to see invocation).

I even tried adding the Xamarin.Firebase.iOS.InstanceID package but get the same error.

DavePilks avatar Feb 15 '20 14:02 DavePilks

Hi @DavePilks! We have released Firebase Remote Config v4.4.6. Can you update and try again, please? Thanks in advance!

SotoiGhost avatar Feb 25 '20 04:02 SotoiGhost

@SotoiGhost I also have the same problem, with the following packages:

ABTesting 3.1.2
Analytics 6.2.1
Core 6.6.0
InstanceID 4.3.0
PerformanceMonitoring 3.1.9
RemoteConfig 4.4.6
Xamarin.Build.Download 0.9.0

The errors that I have are:

/Users/emmanuele.villa/projects/rte/P3-RTEMobile/PlayerTRE/iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: FIRInstanceID. The symbol '_OBJC_CLASS_$_FIRInstanceID' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (PlayerTRE.iOS)
/Users/emmanuele.villa/projects/rte/P3-RTEMobile/PlayerTRE/iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: FIRRemoteConfig. The symbol '_OBJC_CLASS_$_FIRRemoteConfig' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (PlayerTRE.iOS)
/Users/emmanuele.villa/projects/rte/P3-RTEMobile/PlayerTRE/iOS/MTOUCH: Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -framework EventKit -framework MessageUI -lz -lxml2 -ObjC -lsqlite3 -ObjC -lz -lsqlite3 -lc++ -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lstdc++ -lsqlite3 -ObjC -lc++ (MT5201) (PlayerTRE.iOS)
/Users/emmanuele.villa/projects/rte/P3-RTEMobile/PlayerTRE/iOS/MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202) (PlayerTRE.iOS)
/Users/emmanuele.villa/projects/rte/P3-RTEMobile/PlayerTRE/iOS/clang: Error: linker command failed with exit code 1 (use -v to see invocation) (PlayerTRE.iOS)

Before updating the packages and adding PerformanceMonitoring, the following packages worked:

Analytics 5.5.0
Core 6.1.0
InstanceID 3.4.0
Xamarin.Build.Download 0.4.11

I also have problems when trying to update the android versions, could it be a problem with the Xamarin.Build.Download package? In both platforms it works with build.download == 0.4

UPDATE: I tried installing PerformanceMonitoring 2.2.2 which doesn't update xamarin.build.download and it works

EmmanueleVilla avatar Mar 05 '20 12:03 EmmanueleVilla

It is not just RemoteConfig. The latest versions of Xamarin.Google.iOS.MobileAds and Xamarin.Google.iOS.SignIn also produce similar native link errors on iOS.
I am using Xamarin.Forms 4.5.0.356 and Xamarin.iOS v13.14.1.39. I have not checked with earlier versions of Xamarin.Forms since 4.5 will be a strict requirment from apple (see issue #380) in the coming weeks.
The only solution I have found is to downgrade to earlier versions. For example, I have found that Xamarin.Google.iOS.SignIn v4.4 works. Of course with issue #380, we can only hope that both these get fixed at the same time. I have not determined specifically which version it things get broken in yet.

NebulaSleuth avatar Mar 21 '20 21:03 NebulaSleuth

Going back to the basics, I have determined that anytime Xamarin.Firebase.iOS.Core is referenced the native linker errors start to occur. Other packages introduce different linker errors as well, but I am focusing on simply trying to get core working first. I have tried the 'bin/obj' dance, deleting the cache and the .nuget folder about 50 times. Spent all weekend trying to find the right combination to no avail. I do this between each attempted compile and after each package change or update: find . -type d -name obj -prune -exec rm -rf {} ; find . -type d -name bin -prune -exec rm -rf {} ; rm -rf ~/,nuget rm -rf ~/Library/Caches/Xamarin/mtbs/builds

But I cannot get rid of native link errors if I use anything greater than v5.2.0 of Xamarin.Firebase.iOS.Core. Other packages similarly have maximum versions before they suddenly cause problems.
I have created a simple Blank project for Xamarin.Forms (which defaulted to 4.4.0.991265 so I left it), and simply added the Xamarin.Firebase.iOS.Core v6.6.0 (latest) to the iOS project. Build => native link errors.

I am going to go back to the 'working' versions for now, but in 2 weeks I expect I will no longer be able to upload new versions of my App to the App Store unless this and #380 are both resolved.

I have burned a ton of hours trying to get this work. It is broken. Please somebody find me the magic key to open the locked door in this adventure game!!!!!

NebulaSleuth avatar Mar 23 '20 17:03 NebulaSleuth

I am having the exact same problem with Xamarin.Firebase.iOS.Core. 33 native linking failed errors. I have a total of 70 and have yet to figure out which other nuget package is causing the rest.

zirplsoftware avatar Apr 14 '20 17:04 zirplsoftware

I'm also facing the same issue while updating the Xamarin.Firebase.iOS.Analytics to 6.2.1. Below are the native linking errors.

Native linking failed. Please review the build log. Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz. Native linking failed, undefined symbol: _kFIRLoggerMessaging. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. linker command failed with exit code 1 (use -v to see invocation)

Is there any dependency version that needs to be installed in my mac machine-like XCode or SDK?

ganesanvelusamy avatar Apr 15 '20 07:04 ganesanvelusamy

I have a similar issue. Just updated Xamarin to and Firebase to the latest packages, and I get this error:

MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: FIRRemoteConfig. The symbol 'OBJC_CLASS$_FIRRemoteConfig' could not be found in any of the libraries or frameworks linked with your application. (MT5211)

I tracked the error down to a reference in FirebasePerformance:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FIRRemoteConfig", referenced from:
      objc-class-ref in FirebasePerformance(FPRRemoteConfigFlags_71b80df7b60132dc34996f1564188b0a.o)
ld: symbol(s) not found for architecture x86_64
clang : error : linker command failed with exit code 1 (use -v to see invocation)
 

Once I removed the FirebasePerformance library it compiled. I'm not sure what the issue is, perhaps misisng a library dependency?

dczaretsky avatar Apr 18 '20 04:04 dczaretsky

same issue

KennyDizi avatar Apr 21 '20 11:04 KennyDizi

Xamarin.iOS also have the same issue. Need a solution / workaround before April 30 else iOS app is not going to pass review without throwing out Firebase library.

ooikengsiang avatar Apr 24 '20 09:04 ooikengsiang

Could you provide a reproducible test case? Thanks in advance!

SotoiGhost avatar Apr 27 '20 16:04 SotoiGhost

A little further testing on my end, I seem to be experiencing this issue with undefined symbols across a number of the Firebase iOS libraries, in particular with Firebase Analytics. What I found was that if you simply add a Firebase library without integrating it into your code, it seems that some of these objects are being removed through optimzation, and therefore causing linking errors. Once you integrate the library into your code it seems to go away.

I also found that deleting the obj and lib directories, then restoring the packages seems to help in some circumstances.

I don't have enough data to validate this, just going on what others have posted or recommended, and seems to have worked for me. Perhaps try this on your project and see if it works.

Also just to note, currently I have only had to include ONE Firebase library, Xamarin.Firebase.iOS.Analytics, which I had downgraded to version 6.0.4.1 and it is currently compiling and working. Although NuGet specifies a number of dependency libraries for this one, I have not included them in the project and it still works.

dczaretsky avatar Apr 27 '20 16:04 dczaretsky

Facing this issue kindly update solution ....has anyone found any workaround

Error MT5211: Native linking failed, undefined Objective-C class: FIRRemoteConfig. The symbol 'OBJC_CLASS$_FIRRemoteConfig' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (DMI.Xip.iOS)

Waaheeda avatar Apr 30 '20 12:04 Waaheeda

Same issue with Xamarin.Firebase.iOS.Auth

Once Xamarin.Firebase.iOS.Core Version 6.6.0.0 is referenced as dependency the linker errors occur.

Problem is I need to update Xamarin.Firebase.iOS.Auth due to reference of UIWebView in previous version. Due to deprecation Apple won't accept my app now.

freshpatze avatar May 02 '20 17:05 freshpatze

I had the same problem with Firebase Analytics. I removed the package and the dependencies and add the 6.0.4.1 version. It seems ok for now.

jkapsouras avatar May 04 '20 14:05 jkapsouras

I've spend a lot of time trying to fix this error and came up with this solution. I've added dumb reference in AppDelegate to:

RemoteConfig.SharedInstance.ConfigSettings = new RemoteConfigSettings(true);

This way the build will link the library and the build won't fail.

petar-marinov avatar May 07 '20 06:05 petar-marinov

I've spend a lot of time trying to fix this error and came up with this solution. I've added dumb reference in AppDelegate to:

RemoteConfig.SharedInstance.ConfigSettings = new RemoteConfigSettings(true);

This way the build will link the library and the build won't fail.

it is working fo me, thanks

wuhuangjia avatar May 12 '20 03:05 wuhuangjia

@petar-marinov surprisingly your solution works for me too!

RemoteConfig.SharedInstance.ConfigSettings = new RemoteConfigSettings(true);

alexshikov avatar May 25 '20 17:05 alexshikov

I've spend a lot of time trying to fix this error and came up with this solution. I've added dumb reference in AppDelegate to:

RemoteConfig.SharedInstance.ConfigSettings = new RemoteConfigSettings(true);

This way the build will link the library and the build won't fail.

This solution is work

JimmyPun610 avatar Jun 04 '20 00:06 JimmyPun610

This solution works for me as well. But I figured out that just declaring as variable works too: RemoteConfig remoteConfig;

devperson avatar Jun 15 '20 17:06 devperson

I just updated everything to the latest, IDE, Packages, Frameworks, all of it. The previous fixes no longer seemed to work for me. The solution I've found is to add the following to the beginning of the FinishedLaunching function in AppDelegate

Firebase.Core.App.Configure();
_ = Firebase.RemoteConfig.RemoteConfig.SharedInstance;

TheWass avatar Sep 23 '20 22:09 TheWass

I'm using Firebase.iOS.Analytics only and hit similar errors. But just start adding the code and it builds. No runtime error so far

motoko89 avatar Dec 04 '20 18:12 motoko89

I just updated everything to the latest, IDE, Packages, Frameworks, all of it. The previous fixes no longer seemed to work for me. The solution I've found is to add the following to the beginning of the FinishedLaunching function in AppDelegate

Firebase.Core.App.Configure();
_ = Firebase.RemoteConfig.RemoteConfig.SharedInstance;

For users using Xamarin.Firebase.PerformanceMonitoring, replace the RemoteConfig line with

Firebase.PerformanceMonitoring.Performance.SharedInstance.DataCollectionEnabled = true;

juanhaedo-trimble avatar Dec 18 '20 13:12 juanhaedo-trimble

Adding new RemoteConfigSettings(true); in AppDelegate fixed it for me, even though it specifically says it isn't needed.

JesseLiberty avatar Mar 09 '21 19:03 JesseLiberty

In case of using Xamarin.Firebase.iOS.Analytics add Firebase.Analytics.Analytics.SetAnalyticsCollectionEnabled(true); right after Firebase.Core.App.Configure(); in AppDelegate.cs. Should fix the issue.

AnnaBagriy avatar May 11 '21 13:05 AnnaBagriy

In case of using Xamarin.Firebase.iOS.Analytics add Firebase.Analytics.Analytics.SetAnalyticsCollectionEnabled(true); right after Firebase.Core.App.Configure(); in AppDelegate.cs. Should fix the issue.

This worked for me.

DevGuraya2 avatar Jul 28 '21 20:07 DevGuraya2

Encountered this issue recently with Xamarin.Firebase.iOS.PerformanceMonitoring and it disappeared as soon as I updated it the library to v8.10.0

Kapusch avatar Aug 24 '22 21:08 Kapusch