首页 > 解决方案 > 在 Xcode for iOS 上构建时 firebase 出错

问题描述

我在 xcode 中构建应用程序时遇到了一些麻烦,但在 Unity 中构建到 android 工作得很好。我已经搜索过所有其他解决方案都没有帮助我完成构建。我没有使用任何 pod,只是将目标切换到 iOS,签名并尝试构建。xcode 给我的错误是这样的:

仅显示最近的错误

使用配置 ReleaseForRunning 警告构建项目 Unity-iPhone 的目标 UnityFramework:不推荐使用 OpenGLES。考虑改为迁移到 Metal。(在项目“Unity-iPhone”的目标“UnityFramework”中)

Ld /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/UnityFramework normal(在项目'Unity-iPhone'的目标'UnityFramework'中)cd /用户/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。引擎/Vuforia/插件/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。框架/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 -框架 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 /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框架/UnityFramework框架/UnityFrameworkdat -o /Users/schrodingerlab/Library/Developer/Xcode/DerivedData/Unity-iPhone-cznkgmrdhbgorsbwisensbubkxok/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/UnityFrameworkdat -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",引用自:libFirebaseCppApp.a(app_ios_814e1620d4f88024cea4bade26623a67.o) 中的 objc-class-ref" 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 : 未找到架构 arm64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

构建失败 17/3/21, 19:41 151.1 秒

我认为 arm64 库出现错误,因为错误提示,我尝试手动包含它,但仍然得到了 MuskGetLocaleRegion。

感谢您的时间!

标签: iosxcodefirebaseunity3dbuild-error

解决方案


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

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

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?).


推荐阅读