使用 Firebase Unity SDK 的 Firebase Xcode 链接器命令错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41896479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Firebase Xcode linker command error using Firebase Unity SDK
提问by Tim Koppers
Firebase Unity SDK 1.1.1. Unity 5.5.0p4 XCode 8.2.1
Firebase Unity SDK 1.1.1。统一 5.5.0p4 XCode 8.2.1
When using Authentication and Database from Firebase I get the following error when building the project in XCode :
从 Firebase 使用身份验证和数据库时,在 XCode 中构建项目时出现以下错误:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRGoogleAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRGitHubAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIREmailPasswordAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRFacebookAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIRApp", referenced from: objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)
"_OBJC_CLASS_$_FIRAuth", referenced from: objc-class-ref in libAuth.a(auth_ios_3c64a79cf1eb3f06f9309f4d8e91ee94.o)
"_OBJC_CLASS_$_FIRTwitterAuthProvider", referenced from: objc-class-ref in libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
"_OBJC_CLASS_$_FIROptions", referenced from: objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
对于建筑arm64未定义的符号:
“_OBJC_CLASS _ $ _ FIRGoogleAuthProvider”,从引用:在libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)objc级-REF
“_OBJC_CLASS _ $ _ FIRGitHubAuthProvider”,从引用:在libAuth.a objc级-REF(credential_ios_ef8c3cf45c3329a5e5902f99026c639a。 O)
“_OBJC_CLASS _ $ _ FIREmailPasswordAuthProvider”,从引用:在libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)objc级-REF
“_OBJC_CLASS _ $ _ FIRFacebookAuthProvider”,从引用:在libAuth.a objc级-REF(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)
“_OBJC_CLASS_ $_FIRApp”,引用自:libApp 中的 objc-class-ref。a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)
“_OBJC_CLASS _ $ _ FIRAuth”,从引用:在libAuth.a(auth_ios_3c64a79cf1eb3f06f9309f4d8e91ee94.o)objc级-REF
“_OBJC_CLASS _ $ _ FIRTwitterAuthProvider”,从引用:在libAuth.a(credential_ios_ef8c3cf45c3329a5e5902f99026c639a.o)objc级-REF
“_OBJC_CLASS _ $ _ FIROptions ",引用自:libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o) 中的objc-class-ref ld:找不到架构arm64 clang 的符号:错误:链接器命令失败,退出代码为1(使用-v 查看调用)
Do I miss something in XCode? Or have something to check in Unity?
我错过了 XCode 中的某些东西吗?或者在 Unity 中有什么要检查的?
Thanks!
谢谢!
回答by Tommy Leung
I spent a couple of days trying to figure out the errors from building with Unity Cloud Build vs building locally. Hopefully this can help someone else!
我花了几天时间试图找出使用 Unity Cloud Build 构建与本地构建的错误。希望这可以帮助别人!
Building Locally
本地建设
This just worked as long as you have CocoaPods installed. An error will appear in the Unity console after building for iOS if CocoaPods is not installed. Other than that, the instructions provided by Firebase worked fine with Unity 5.6 and Xcode 8.3.
只要您安装了 CocoaPods,这就会起作用。如果未安装 CocoaPods,则在为 iOS 构建后,Unity 控制台中将出现错误。除此之外,Firebase 提供的说明适用于 Unity 5.6 和 Xcode 8.3。
Building with Unity Cloud Build
使用 Unity Cloud Build 构建
CocoaPods is not available on UCB but Firebase has a non-CocoaPods alternative: https://firebase.google.com/docs/ios/setup#frameworks
CocoaPods 在 UCB 上不可用,但 Firebase 有一个非 CocoaPods 替代方案:https://firebase.google.com/docs/ios/setup#frameworks
Add Frameworks Manually
手动添加框架
The instructions are assuming a native iOS build but you can simply drag the frameworks you need into Assets/Plugins/iOS/Firebase instead of into an Xcode project. Unity will add those frameworks to the Xcode project on build.
这些说明假设使用原生 iOS 构建,但您可以简单地将您需要的框架拖入 Assets/Plugins/iOS/Firebase 而不是 Xcode 项目。Unity 将在构建时将这些框架添加到 Xcode 项目中。
Add Linker Flag
添加链接器标志
You will need to manually add -ObjC
into Other Link Flags. For some reason it showed up in my local Xcode project but not when UCB made the build. Create a post process script much like maros mentioned: https://forum.unity3d.com/threads/problem-building-ios-app-with-cloud-build-using-google-analytics.390803/#post-2549911
您将需要手动添加-ObjC
到其他链接标志。出于某种原因,它出现在我本地的 Xcode 项目中,但没有出现在 UCB 进行构建时。创建一个类似于 maros 提到的后期处理脚本:https://forum.unity3d.com/threads/problem-building-ios-app-with-cloud-build-using-google-analytics.390803/#post-2549911
You will need to add -ObjC
like this:
您需要-ObjC
像这样添加:
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
If you do not add this part, UCB may still create a build but the game will crash immediately after trying to create FirebaseAuth as it will reference an extension/category method that was not included due to the missing -ObjC
flag.
如果您不添加此部分,UCB 可能仍会创建构建,但在尝试创建 FirebaseAuth 后游戏将立即崩溃,因为它将引用由于缺少-ObjC
标志而未包含的扩展/类别方法。
Add Other Required Frameworks and Libraries
添加其他必需的框架和库
Depending on which Firebase features you are using, you may need different additional frameworks or libs. For example I had used FirebaseDatabase and while the docs did not mention this, Xcode complained about a linker error that required me to add libicucore.tbd
.
根据您使用的 Firebase 功能,您可能需要不同的额外框架或库。例如,我使用过 FirebaseDatabase,虽然文档没有提到这一点,但 Xcode 抱怨链接器错误,需要我添加libicucore.tbd
.
The best way I could think to solve this was uninstall CocoaPods locally and then have Unity create the Xcode project so that I could get a more accurate representation of what UCB would experience. This part may take some trial and error as well as Googling to figure out which framework or lib the linker error is referring to. Just try to build the Xcode project locally and you will get the linker errors if any.
我认为解决这个问题的最好方法是在本地卸载 CocoaPods,然后让 Unity 创建 Xcode 项目,这样我就可以获得更准确的 UCB 体验。这部分可能需要一些试验和错误以及谷歌搜索来找出链接器错误所指的框架或库。只需尝试在本地构建 Xcode 项目,您就会收到链接器错误(如果有)。
I added:
我补充说:
List<string> frameworks = new List<string>() {
"AdSupport.framework",
"CoreData.framework",
"SystemConfiguration.framework",
"libz.dylib",
"libsqlite3.dylib",
"libicucore.tbd"
};
Manually Move GoogleServices-Info.plist
手动移动 GoogleServices-Info.plist
Another oddity is that UCB did not move the GoogleServices-Info.plist into the Xcode project. There must be some other script that is not running on UCB that does run locally. In the post process script where you add the linker flag and frameworks, you can also move the GoogleServices-Info.plist into the Xcode project directory and then add it to the bundle.
另一个奇怪的是 UCB 没有将 GoogleServices-Info.plist 移动到 Xcode 项目中。必须有一些其他脚本不在本地运行的 UCB 上运行。在添加链接器标志和框架的后期处理脚本中,您还可以将 GoogleServices-Info.plist 移动到 Xcode 项目目录中,然后将其添加到包中。
First move the file:
首先移动文件:
if (!File.Exists(path + "/GoogleService-Info.plist"))
{
FileUtil.CopyFileOrDirectory ("GoogleService-Info.plist", path + "/GoogleService-Info.plist");
}
Then add it to the build:
然后将其添加到构建中:
string guid = proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist");
proj.AddFileToBuild(target, guid);
And that should be it. I will update if I run into any other issues as I add more Firebase features. Currently I am using Auth, Database, and Analytics.
应该就是这样。如果我在添加更多 Firebase 功能时遇到任何其他问题,我会更新。目前我正在使用身份验证、数据库和分析。
回答by jauboux
First, thanks to all for sharing your (hard) work !
首先,感谢大家分享你的(努力)工作!
A lot has been said on the subject, but it took me a lotof time and a lotof trial and error to gather all the pieces on both SO & Unity forums, so I will just post the solution that I finally worked out, which finally solved all issues for me, using unity cloud build/Unity 5.6.0f3/Xcode 8.0, the project using only firebase analytics package
关于这个主题已经说了很多,但是我花了很多时间和大量的反复试验来收集 SO 和 Unity 论坛上的所有内容,所以我只会发布我最终制定的解决方案,其中最终为我解决了所有问题,使用 unity cloud build/Unity 5.6.0f3/Xcode 8.0,该项目仅使用了 firebase 分析包
SOLUTION FOR UNITY CLOUD BUILD
统一云构建解决方案
- completely disable cocoapods from Unity > Assets > Play Services Resolver > iOS Resolver > Settings (uncheck "Podfile Generation" and "Auto Install Cocoapod Tools in Editor", choose "None - do not integrate Cocoapods") p
- put GoogleServices-Info.plist in the Unity "Assets" folder
- PostBuildProcessor method:
- 从 Unity > Assets > Play Services Resolver > iOS Resolver > Settings 中完全禁用 cocoapods(取消选中“Podfile Generation”和“Auto Install Cocoapod Tools in Editor”,选择“None - do not integration Cocoapods”)p
- 将 GoogleServices-Info.plist 放在 Unity“Assets”文件夹中
- PostBuildProcessor 方法:
private static void ProcessPostBuild (BuildTarget buildTarget, string path)
{
// Only perform these steps for iOS builds
#if UNITY_IOS
Debug.Log ("[UNITY_IOS] ProcessPostBuild - Adding Google Analytics frameworks.");
// Go get pbxproj file
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
// PBXProject class represents a project build settings file,
// here is how to read that in.
PBXProject proj = new PBXProject ();
proj.ReadFromFile (projPath);
// This is the Xcode target in the generated project
string target = proj.TargetGuidByName("Unity-iPhone");
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-v");
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
if (!File.Exists(path + "/GoogleService-Info.plist"))
{
FileUtil.CopyFileOrDirectory("Assets/GoogleService-Info.plist", path + "/GoogleService-Info.plist");
}
string guid = proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist");
proj.AddFileToBuild(target, guid);
// List of frameworks that will be added to project
List<string> frameworks = new List<string>() {
"AddressBook.framework",
"AdSupport.framework",
"CoreData.framework",
"SystemConfiguration.framework",
};
// Add each by name
frameworks.ForEach((framework) => {
proj.AddFrameworkToProject(target, framework, false);
});
// List of frameworks that will be added to project
List<string> usrLibFrameworks = new List<string>() {
"libsqlite3.tbd",
"libz.tbd",
"libicucore.tbd",
};
// Add each by name
usrLibFrameworks.ForEach((framework) => {
proj.AddFileToBuild(target, proj.AddFile("usr/lib/"+ framework, "Frameworks/" + framework, PBXSourceTree.Sdk));
});
// Write PBXProject object back to the file
proj.WriteToFile (projPath);
#endif
}
PS it's crazy that firebase unity sdk is requiring such hacks to work (UCB is an absolute requirement for us and I guess for most multiplatform mobile developers) and I hope all those workarounds will soon be useless, but judging that all those issues are here from the beginning of official firebase Unity support, I wouldn't count too much on it
PS,firebase unity sdk 需要这样的 hack 来工作真是太疯狂了(UCB 是我们的绝对要求,我想对于大多数多平台移动开发人员来说),我希望所有这些解决方法很快就会无用,但判断所有这些问题都来自Firebase Unity 官方支持的开始,我不会太指望它
回答by Marc Denessen
I had the same problem, just fixed it.
我遇到了同样的问题,刚刚修复了它。
Find the Podfile file and open it in a text editor. remove
找到 Podfile 文件并在文本编辑器中打开它。消除
, :integrate_targets => false
, :integrate_targets => 假
in the second line so it says: install! 'cocoapods'
在第二行,它说:安装!“可可豆”
Then add a new line after platform: ios...
然后在平台后添加一个新行:ios...
use_frameworks!
使用_框架!
Then open a terminal screen and go to the directory of this project. Type 'pod install' and enter. If everything goes well a workspace file is created and a message appears that you should open the workspace in Xcode in stead of the project. So close the project in xcode and open the projectname.xcworkspace file. Now Xcode will open the workspace and you will be able to run the project. You may have to adjust your Deployment Target to 8.0. Hope this works for you
然后打开一个终端屏幕并转到该项目的目录。输入“pod install”并输入。如果一切顺利,就会创建一个工作区文件,并显示一条消息,提示您应该在 Xcode 中打开工作区而不是项目。所以在xcode中关闭项目,打开projectname.xcworkspace文件。现在 Xcode 将打开工作区,您将能够运行该项目。您可能需要将部署目标调整为 8.0。希望这对你有用
回答by Mohammad Ibreighith DrMSI
I just figure it out , just use older version in your pod file created by unity to be like this
我只是想通了,只需在您的 pod 文件中使用由 unity 创建的旧版本,就像这样
target 'Unity-iPhone' do pod 'Firebase/Analytics', '3.17.0' pod 'Firebase/Auth', '3.17.0' pod 'Firebase/Core', '3.17.0' pod 'Google-Mobile-Ads-SDK', '7.13' end
目标 'Unity-iPhone' do pod 'Firebase/Analytics', '3.17.0' pod 'Firebase/Auth', '3.17.0' pod 'Firebase/Core', '3.17.0' pod 'Google-Mobile-Ads -SDK', '7.13' 结束
///note: //
///笔记: //
Don't forgot to set the Enable Modules (c and Objective-c) to yes in building setting for (Google-Mobile-Ads-SDK)
不要忘记在(Google-Mobile-Ads-SDK)的构建设置中将启用模块(c和Objective-c)设置为yes
then open folder from terminal and run: ->pod install to update pods
然后从终端打开文件夹并运行:->pod install 更新 pods
:)
:)
回答by Branko de Enero
Building Unity app with Firebase framework locally with Xcode:
使用 Xcode 在本地使用 Firebase 框架构建 Unity 应用程序:
It is all about the iOS SDK version. This answer have part of the solution: https://stackoverflow.com/a/41908040/8063631
这都是关于 iOS SDK 版本的。这个答案有一部分解决方案:https: //stackoverflow.com/a/41908040/8063631
Working on Mac environment.
在 Mac 环境下工作。
When build in Unity to iOS. Be sure checked before: Assets -> iOS Resolver -> Setting
在 Unity 中构建到 iOS 时。确保之前检查过:Assets -> iOS Resolver -> Setting
- Cocoapods Integration
- Xcode Workspace - Add cocoa pods to the Xcode Workspace
- Auto install Cocoapods Tools in Editor
- 可可豆集成
- Xcode 工作区 - 将可可豆添加到 Xcode 工作区
- 在编辑器中自动安装 Cocoapods 工具
Build to iOS and open .workspace file.
构建到 iOS 并打开 .workspace 文件。
Then go to Pods -> Podfile and add the past release version (3.7.0), because the 4.0.0 launch that error.
然后转到 Pods -> Podfile 并添加过去的发布版本 (3.7.0),因为 4.0.0 启动该错误。
target 'Unity-iPhone' do
pod 'Firebase/Auth'
pod 'Firebase/Core'
end
by (for example...)
通过(例如...)
target 'Unity-iPhone' do
pod 'Firebase/Auth', '3.7.0'
pod 'Firebase/Core', '3.7.0'
end
Close xCode IDE to avoid conflicts, then install Cocoapods if you don't have it yet (https://guides.cocoapods.org/using/getting-started.html):
关闭 xCode IDE 以避免冲突,如果您还没有 Cocoapods,请安装它(https://guides.cocoapods.org/using/getting-started.html):
Check with:
检查:
pod --version
Install with:
安装:
sudo gem install cocoapods
Go to your project folder by running Terminal and type:
通过运行终端转到您的项目文件夹并键入:
pod install
It will remove the current versión and it replace it by the 3.7.0
它将删除当前版本并将其替换为 3.7.0
Open xCode and press Product -> Clean and Product -> Build
打开 xCode 并按 Product -> Clean and Product -> Build
回答by Khalid Musa Sagar
I had the same problem, after spend couple of hours i got the main problem.
我遇到了同样的问题,花了几个小时后,我遇到了主要问题。
It was the podfile library's defined specific version.
它是 podfile 库定义的特定版本。
target 'Unity-iPhone' do
pod 'Firebase/Auth', '4.10.0'
pod 'Firebase/Core', '4.10.0'
end
When unity build iOS project's podfile they define their latest library version. But when from xcode/terminal try to update pod library from GIT and the specific version is not available then its failed to update and showing this error.
当 unity 构建 iOS 项目的 podfile 时,它们定义了最新的库版本。但是当从 xcode/终端尝试从 GIT 更新 pod 库并且特定版本不可用时,它无法更新并显示此错误。
Solution is simple just don't need to define the specific version. pod will update the GIT's latest version.
解决方案很简单,只是不需要定义特定的版本。pod 将更新 GIT 的最新版本。
target 'Unity-iPhone' do
pod 'Firebase/Auth'
pod 'Firebase/Core'
end
回答by Mahmoud Ashraf
i had this issue and was fixed by updating the pods installation one way was clearing the locally cached copy and reinstall it again and another way was to force the installation to be from an online source
我遇到了这个问题,并通过更新 pods 安装得到了解决,一种方法是清除本地缓存的副本并重新安装它,另一种方法是强制安装来自在线源
it worth mention that the building to IOS was succeeded
值得一提的是,构建到IOS成功了
Build completed with a result of 'Succeeded'
构建完成,结果为“成功”
but had an error installing the pods
但在安装 Pod 时出错
Solution one
解决方案一
on the mac terminal change directory to the builded folder that should contain a Podfile
在 mac 终端上,将目录更改为应包含一个的构建文件夹 Podfile
executed the following
执行了以下操作
$ pod repo remove master
$ pod install --repo-update
Rebuild the project from unity should install the pods
automatically
从统一重建项目应该pods
自动安装
Other solution
其他解决方案
Installing from GitHub
从 GitHub 安装
see Firebase podsfor more information
有关详细信息,请参阅Firebase pod
For releases starting with 5.0.0, the source for each release is also deployed to CocoaPods master and available via standard CocoaPods Podfile syntax.
对于从 5.0.0 开始的版本,每个版本的源代码也部署到 CocoaPods master 并通过标准 CocoaPods Podfile 语法提供。
These instructions can be used to access the Firebase repo at other branches, tags, or commits.
这些说明可用于在其他分支、标签或提交处访问 Firebase 存储库。
Background
背景
See the Podfile Syntax Reference for instructions and options about overriding pod source locations.
有关覆盖 pod 源位置的说明和选项,请参阅 Podfile 语法参考。
Step-by-step Source Pod Installation Instructions
分步 Source Pod 安装说明
For iOS, copy a subset of the following lines to your Podfile
:
对于 iOS,请将以下行的子集复制到您的Podfile
:
pod 'Firebase' # To enable Firebase module, with `@import Firebase` support
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseAuth', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseDatabase', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseFunctions', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseMessaging', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseStorage', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'Firebase' # To enable Firebase module, with `@import Firebase` support
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseAuth', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseDatabase', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseFunctions', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseMessaging', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseStorage', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
For macOS and tvOS, copy a subset of the following:
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseAuth', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseDatabase', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseStorage', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
对于 macOS 和 tvOS,请复制以下内容的子集:
pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseAuth', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseDatabase', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
pod 'FirebaseStorage', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :tag => '5.0.0'
1- Make sure you have at least CocoaPods version 1.4.0 - pod --version.
1- 确保你至少有 CocoaPods 版本 1.4.0 - pod --version。
2- Delete pods for any components you don't need, except FirebaseCore must always be included.
2- 删除不需要的任何组件的 pod,但必须始终包含 FirebaseCore。
3- Update the tags to the latest Firebase release. See the release notes
3- 将标签更新到最新的 Firebase 版本。查看发行说明
4- Run pod update.
4- 运行 pod 更新。
回答by maros
CocoaPods
可可豆
CocoaPods is a dependency manager for iOS/macOS projects. It is used for installing external frameworks/libraries to your project.
CocoaPods 是 iOS/macOS 项目的依赖管理器。它用于为您的项目安装外部框架/库。
Building Unity app with Firebase framework locally with Xcode:
使用 Xcode 在本地使用 Firebase 框架构建 Unity 应用程序:
You need to have cocoapods installed on your system: https://guides.cocoapods.org/using/getting-started.html#toc_3
您需要在您的系统上安装 cocoapods:https: //guides.cocoapods.org/using/getting-started.html#toc_3
Building Unity app with Firebase framework on Unity Build Cloud:
在 Unity Build Cloud 上使用 Firebase 框架构建 Unity 应用程序:
For the users who experience this issue on Unity Build Cloud server.
对于在 Unity Build Cloud 服务器上遇到此问题的用户。
According to this forum thread: https://forum.unity3d.com/threads/build-failed-cocoapods.421286/supporting cocoapods is not supported. (and probably not even scheduled for development).
根据这个论坛帖子:https: //forum.unity3d.com/threads/build-failed-cocoapods.421286/ 不支持支持 cocoapods。(甚至可能没有计划开发)。
Cocoapods are responsible for having all referenced libraries for your iOS project setup in your Xcode project. As they are not supported on Unity Build Cloud, you need to do it manually.
Cocoapods 负责在你的 Xcode 项目中为你的 iOS 项目设置所有引用的库。由于 Unity Build Cloud 不支持它们,您需要手动完成。
make sure you have installed cocoapods on your macOS system: https://guides.cocoapods.org/using/getting-started.html#toc_3
build your Unity app locally (don't trigger the build on the cloud). The build exports an Xcode project (which should be runnable). This Xcode project contains libraries (Frameworks) you need to add to the Unity project.
move all the *.framework folders from EXPORTED_XCODE_PROJECT/Frameworksto YOUR_UNITY_PROJECT/Assets/Plugins/iOSe.g.: FirebaseAnalytics.framework, FirebaseCore.framework
Firebase requires iOS sqlite framework to be also included in the project. For that use this solution: https://forum.unity3d.com/threads/problem-building-ios-app-with-cloud-build-using-google-analytics.390803/#post-2549911In the class PostBuildProcessormodify the method ProcessPostBuild,
// ObjC - needed for Firebase proj.AddBuildProperty (target, "OTHER_LDFLAGS", "-ObjC");
List<string> frameworks = new List<string>() { "AdSupport.framework", "CoreData.framework", "SystemConfiguration.framework", "libz.dylib", "libsqlite3.dylib", "libApp.a", "libAnalytics.a" };
确保你已经在你的 macOS 系统上安装了 cocoapods:https: //guides.cocoapods.org/using/getting-started.html#toc_3
在本地构建您的 Unity 应用程序(不要在云上触发构建)。构建导出一个 Xcode 项目(应该是可运行的)。这个 Xcode 项目包含您需要添加到 Unity 项目的库(框架)。
将所有 *.framework 文件夹从EXPORTED_XCODE_PROJECT/Frameworks 移动到YOUR_UNITY_PROJECT/Assets/Plugins/iOS例如:FirebaseAnalytics.framework, FirebaseCore.framework
Firebase 要求项目中也包含 iOS sqlite 框架。为此,请使用此解决方案:https: //forum.unity3d.com/threads/problem-building-ios-app-with-cloud-build-using-google-analytics.390803/#post-2549911在PostBuildProcessor类中修改方法ProcessPostBuild,
// ObjC - needed for Firebase proj.AddBuildProperty (target, "OTHER_LDFLAGS", "-ObjC");
List<string> frameworks = new List<string>() { "AdSupport.framework", "CoreData.framework", "SystemConfiguration.framework", "libz.dylib", "libsqlite3.dylib", "libApp.a", "libAnalytics.a" };
Save the Unity project and by now the iOS Unity Build Cloud should work
保存 Unity 项目,现在 iOS Unity Build Cloud 应该可以工作了