Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

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

Open
DavePilks opened this issue Feb 15, 2020 · 26 comments

Comments

@DavePilks
Copy link

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.

@SotoiGhost
Copy link
Contributor

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

@EmmanueleVilla
Copy link

EmmanueleVilla commented Mar 5, 2020

@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

@Redth Redth removed the needs-info label Mar 6, 2020
@NebulaSleuth
Copy link

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
Copy link

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!!!!!

@zirplsoftware
Copy link

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.

@ganesanvelusamy
Copy link

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?

@dczaretsky
Copy link

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?

@KennyDizi
Copy link

same issue

@ooikengsiang
Copy link

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.

@SotoiGhost
Copy link
Contributor

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

@dczaretsky
Copy link

dczaretsky commented Apr 27, 2020

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.

@Redth Redth removed the needs-info label Apr 28, 2020
@Waaheeda
Copy link

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)

@freshpatze
Copy link

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.

@jkapsouras
Copy link

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.

@petar-marinov
Copy link

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.

@wuhuangjia
Copy link

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

@alexshikov
Copy link

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

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

@JimmyPun610
Copy link

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

@devperson
Copy link

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

@TheWass
Copy link

TheWass commented Sep 23, 2020

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;

@motoko89
Copy link

motoko89 commented Dec 4, 2020

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

@juanhaedo-trimble
Copy link

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;

@JesseLiberty
Copy link

JesseLiberty commented Mar 9, 2021

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

@AnnaBagriy
Copy link

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.

@DevGuraya2
Copy link

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.

@Kapusch
Copy link

Kapusch commented Aug 24, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests