'Error with firebase while building on Xcode for iOS

im having some troubles building an app in xcode but the build in Unity to android works just fine. I have searched all over and none of the other solutions helped me to get the build done. Im not using any pods just switch target to iOS, signing and trying to build. The error that xcode gives me is this:

Showing Recent Errors Only

Build target UnityFramework of project Unity-iPhone with configuration ReleaseForRunning warning: OpenGLES is deprecated. Consider migrating to Metal instead. (in target 'UnityFramework' from project 'Unity-iPhone')

Ld /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/UnityFramework normal (in target 'UnityFramework' from project 'Unity-iPhone') cd /Users/schrodingerlab/Thermomix_40/buildenios6 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios12.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk -L/Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos -L/Users/schrodingerlab/Thermomix_40/buildenios6/Libraries -L/Users/schrodingerlab/Thermomix_40/buildenios6/Libraries/com.ptc.vuforia.engine/Vuforia/Plugins/iOS -L/Users/schrodingerlab/Thermomix_40/buildenios6/Libraries/Plugins/iOS/Firebase -F/Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos -F/Users/schrodingerlab/Thermomix_40/buildenios6/Frameworks/com.unity.ads/Plugins/iOS -F/Users/schrodingerlab/Thermomix_40/buildenios6/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS -filelist /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/Objects-normal/arm64/UnityFramework.LinkFileList -install_name @rpath/UnityFramework.framework/UnityFramework -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -map -Xlinker /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/UnityFramework-LinkMap-normal-arm64.txt -dead_strip -Xlinker -object_path_lto -Xlinker /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/Objects-normal/arm64/UnityFramework_lto.o -fembed-bitcode-marker -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -lc++ -weak_framework CoreMotion -weak-lSystem -liPhone-lib -framework Security -framework MediaToolbox -framework CoreText -framework AudioToolbox -weak_framework AVFoundation -framework AVKit -framework CFNetwork -framework CoreGraphics -framework CoreMedia -weak_framework CoreMotion -framework CoreVideo -framework Foundation -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -lil2cpp -framework UnityAds -lVuforiaWrapper -framework Vuforia -lFirebaseCppMessaging -lFirebaseCppAnalytics -lFirebaseCppApp -framework AdSupport -framework CoreTelephony -framework StoreKit -framework CoreLocation -weak_framework Metal -weak_framework GameController -weak_framework UserNotifications -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/Objects-normal/arm64/UnityFramework_dependency_info.dat -o /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/UnityFramework

Undefined symbols for architecture arm64: "OBJC_CLASS$_FIRConfiguration", referenced from: objc-class-ref in libFirebaseCppApp.a(log_ios_dd26aec5b8537064a4c15d38b58b4640.o) "OBJC_CLASS$_FIRMessaging", referenced from: objc-class-ref in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o) "OBJC_CLASS$_FIRApp", referenced from: objc-class-ref in libFirebaseCppApp.a(app_ios_814e1620d4f88024cea4bade26623a67.o) "OBJC_CLASS$_FIROptions", referenced from: objc-class-ref in libFirebaseCppApp.a(app_ios_814e1620d4f88024cea4bade26623a67.o) "_MuskGetLocaleRegion", referenced from: _DeviceCountryProvider_Awake_mEE95CC492427159A08D423192B51472917D33011 in Assembly-CSharp2.o _DeviceCountryProvider_MuskGetLocaleRegion_mDEF69019B1CC4B23AAB2F05C013AAD759104CA9C in Assembly-CSharp2.o (maybe you meant: _DeviceCountryProvider_MuskGetLocaleRegion_mDEF69019B1CC4B23AAB2F05C013AAD759104CA9C) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Build failed 17/3/21, 19:41 151.1 seconds

I think i have an error with the arm64 library as the error sugest and i tried to include it manually but still got the MuskGetLocaleRegion.

Thank you for your time!



Solution 1:[1]

It does look like you're either skipping the CocoaPods step in Unity or you've disabled some core functionality of the Firebase Unity SDK. It's also possible that you've run into an issue mixing Firebase with another library. I'll give you some quick debugging tips and what to do to file a bug report if it is a bigger issue.

First, since this is a new project, make sure your Firebase Unity SDK is updated to the latest (currently 7.1.0).

Next, you need to make sure that CocoaPods is properly installed. This should happen automatically, but you might as well check. If you type pod, you should see some output other than "command not found". If you don't have it, you can always navigate to "Assets>External Dependency Manager>iOS Resolver>Install Cocoapods" to do so: Screenshot showing "Install Cocoapods" at "Assets>External Dependency Manager>iOS Resolver"

You may also opt to install CocoaPods directly following this guide. Finally, we did find that sometimes CocoaPods required uninstalling/reinstalling across certain OS upgrades (notably moving onto Catalina). This likely doesn't apply, but you can try uninstalling if you run into continued issues.

The mechanism by which Firebase associates the proper Pod files with a built Unity game is called the "External Dependency Manager for Unity" (EDM4U). It may be worth opening the "iOS Resolver Settings" (in the same menu where you found "Install Cocoapods") and resetting to default. For convenience I've included a screenshot of my settings page: Screenshot of my "iOS Resolver Settings". The following options are selected. Podfile Generation: true. Cocoapods Integration: Xcode Workspace. Use Shell to Execute Cocoapod Tool: true. Auto Install Cocoapod Tools in Editor: true. Add use_frameworks! to Podfile: true. Link frameworks statically: false. Always add the main target to Podfile: true. Allow the same pod to be in multiple targets: true. Enable Analytics Reporting: true. Verbose Logging: false. Use project settings: true.

Since you've been running into issues previously, now would be a good time to delete your previously generated project. Then you can click "Build And Run" from your "Build Settings" window. Unity should generate your xcodeproj, generate a Podfile, use the Podfile to generate an xcworkspace, then open the xcworkspace for you.

Building and running from here should work.

Sometimes folks still run into issues. There are some moving parts here: Unity version, Cocoapods version, Firebase version, and dependency manager version not to mention any other libraries either using EDM4U or doing their own custom work to integrate (notably we've seen that almost every tool to "make an iOS build from Windows" fails to work).

So in addition to just making sure your Podfile looks roughly like what you might expect from the iOS getting started guide, updating Cocoapods, and updating Firebase (do not follow the iOS guide, Unity is different enough that you should follow the Unity guide), you may want to follow up on the public issue tracker. When you do so, the first thing to do would be to verify that your setup works with the quickstart for the Firebase products you use (it looks like Messaging from your error log?).

Solution 2:[2]

  1. Open terminal window

  2. Go to project folder and run this:

"pod update"

  1. Then close and re-open Xcode workspace file and build it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patrick Martin
Solution 2 Hamdi Ekmen