2

I get many error messages if I install the Xamarin.Firebase.iOS.CloudMessaging 3.1.2 nuget package.

Error: linker command failed with exit code 1 (use -v to see invocation)

Error MT5210: Native linking failed, undefined symbol: _FIRLogBasic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.

Error MT5211: Native linking failed, undefined Objective-C class: FIROptions. The symbol '_OBJC_CLASS_$_FIROptions' could not be found in any of the libraries or frameworks linked with your application.

Error MT5211: Native linking failed, undefined Objective-C class: GULAppEnvironmentUtil. The symbol '_OBJC_CLASS_$_GULAppEnvironmentUtil' could not be found in any of the libraries or frameworks linked with your application.

Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC

Error MT5202: Native linking failed. Please review the build log.

I tried uninstalling and reinstalling the nuget package but I still get the same errors.

I use Visual Studio Community for Mac 8.1.5 (build 9).

I need Xamarin.Firebase.iOS.CloudMessaging because I follow this tutorial: https://www.robbiecode.com/setup-push-notifications-with-firebase-in-xamarin-forms-for-ios/

What is wrong with my project? What can I do?

The following two projects are in my solution: InapppurchaseTest.iOS, MonoGame.Framework.iOS (develop)

enter image description here

Hobbit7
  • 313
  • 3
  • 16

1 Answers1

5

Well, this is a well-known issue with Firebase and Xamarin, what basically happens here is the old bin and obj files while interacting with the new data override some existing files that are needed by iOS to synthesize the IPA while deployment and hence ends up throwing linking RELATED errors, follow the below steps and it will clear this mess.

  • Clean bin and obj
  • Delete the builds in the following path of your MAC machine - ~/Library/Caches/Xamarin/mtbs/builds/ProjNAME where 'ProjName' is the name of the project you are currently working on
  • Once you are done with both the above steps add the Xamarin.Firebase.iOS.CloudMessaging package and change linker setting to Don't Link (this is for the time being)
  • After installing these packages see to it that you build your project dependency wise which means PCL'S and .Net standards first then the native iOS project.
  • Clean bin and obj again if it does not work for the first build...

This should solve your issues in case it does not repeat the above procedure.

EDIT

If you check the GitHub comment by SotoiGhost here, it says adding the below line anywhere in your project should solve this issue...

var foo = Firebase.Core.Configuration.SharedInstance;

Feel free to get back in case of issues

Good luck!

FreakyAli
  • 13,349
  • 3
  • 23
  • 63
  • There is no Xamarin/mtbs folder in Caches. I have two folders in Caches: Xamarin.Android and XamarinBuildDownload. But there is no mtbs folder in these folders. – Hobbit7 Jul 22 '19 at 11:11
  • Do you have Visual Studio for mac? – FreakyAli Jul 22 '19 at 11:28
  • Yes, Visual Studio for Mac Community 8.1.5 (build 9). – Hobbit7 Jul 22 '19 at 12:23
  • I did the first step(I deleted bin, obj and .vs folders) and the third step but I still get the same error messages. In addition, I cleaned and rebuild my solution in Visual Studio. I don't know how to do step 4: "PCL'S and .Net standards first then the native iOS project." How can I influence the build order? I added a picture of my solution in VS. – Hobbit7 Jul 22 '19 at 15:02
  • You can set the build order using project build order as mentioned here https://stackoverflow.com/questions/3653973/visual-studio-2010-how-to-enforce-build-order-of-projects-in-a-solution, or you can just do that manually, what I basically mean is you build the iOS project when all the dependent projects are already built – FreakyAli Jul 22 '19 at 15:25
  • I don't know how to edit the build order in VS for Mac because I don't have "Project Build Order..." in the context menu. Is the project "MonoGame.Framework.iOS (develop)" not automatically build before "InapppurchaseTest.iOS" because I added a reference in "InapppurchaseTest.iOS" to "MonoGame.Framework.iOS (develop)"? – Hobbit7 Jul 22 '19 at 21:37
  • Yeah pretty much – FreakyAli Jul 23 '19 at 05:26
  • 1
    This line of code solved the problem: var foo = Firebase.Core.Configuration.SharedInstance; Now, I get no more error messages. I found the code here: https://github.com/xamarin/GoogleApisForiOSComponents/issues/158 – Hobbit7 Jul 23 '19 at 08:11
  • @Hobbit7 Will update my answer mark it correct if it works for you! – FreakyAli Jul 23 '19 at 09:26
  • This helped solve my problem at https://stackoverflow.com/questions/61410214 Error MT5210: Native linking failed, undefined symbol: _GULIsLoggableLevel. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210) – Bill Needels Apr 25 '20 at 15:42
  • @BillNeedels Happy to help :) – FreakyAli Apr 27 '20 at 06:12