Firebase Unity iOS问题 [英] Firebase Unity iOS Problems

查看:333
本文介绍了Firebase Unity iOS问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Unity的Android构建中成功设置了Firebase,但是我确实在努力使其能够在iOS构建中运行。



Unity Firebase项目已安装并且看起来不错:



我已遵循以下所有步骤:



尝试解决此模块已禁用错误:



然后在构建之后我看到的是:



然后我尝试添加GoogleMobileAds.framework iOS框架:



再次运行后,出现以下错误:



在线阅读了这些错误之后,CocoaPods引起了很多关注,但是运行pod init只是创建了一个空白工作区,无法解决我的问题。

解决方案

我遇到了类似的问题,并且能够通过进入应用程序的Xcode目录并运行 pod init来在XCode中构建我的应用程序。这创建了podfile。然后,我用SublimeText编辑了该文件(显然有些编辑器在编辑该文件时会出现问题,原因尚不完全清楚),然后添加所需的Pod。我的podfile最终看起来像这样:

  platform:ios,'7.0'target 
'Unity-iPhone'do
pod'Firebase / Analytics','〜> 3.10
pod Firebase / Auth,〜> 3.10
pod Firebase / Core,〜> 3.10
pod Firebase / Messaging,〜> 3.10
pod Firebase / RemoteConfig,〜> 3.10'
end

然后我在同一目录中运行了 pod install .xcworkspace文件(这花了一些时间,因为它安装了一些先决条件)。打开.xcworkspace文件,我便能够成功构建并运行我的应用程序。我遇到了其他运行时问题(这就是为什么我今天使用StackOverflow的原因),但这至少可以编译项目。



您将需要一个副本GoogleServices-info.plist文件添加到应用程序的xcode目录中。 Unity为我自动复制了它,但是YMMV。



希望这会有所帮助。


I have setup Firebase successfully under my Android build in Unity, but am really battling getting it working in my iOS build.

Unity Firebase project was setup and looks fine:

I have followed all the steps on: https://firebase.google.com/docs/unity/setup

I have installed CocoaPods:

skywalker:sl leonard$ pod --version
1.2.0

Here is the top level generated iOS project:

skywalker:sl leonard$ ls
Classes                    Libraries
Data                    MapFileParser
Info.plist                MapFileParser.sh
LaunchScreen-iPad.png            Unity-iPhone
LaunchScreen-iPad.xib            Unity-iPhone Tests
LaunchScreen-iPhone.xib            Unity-iPhone.xcodeproj
LaunchScreen-iPhoneLandscape.png    UnityData.xcassets
LaunchScreen-iPhonePortrait.png        build

I don't see the GoogleService-Info.plist file being added and also expected a Podfile (but I'm just guessing that it would generate one).

The project generates errors and trying to manually resolve them just creates more errors.

Here is the project right after the first build:

Trying to resolve this modules disabled error:

Then after building this is what I see:

I then tried adding the GoogleMobileAds.framework iOS framework:

After running again I get these errors:

After reading online about these errors there's a lot of mention around CocoaPods, but running pod init just created a blank workspace and didn't resolve my issue.

解决方案

I had a similar problem and was able to get my app building in XCode by going to the App's Xcode directory and running "pod init". This created the podfile. I then edited that file with SublimeText (apparently some editors cause problems editing this file, I'm not fully clear on why) and adding the pods I needed. My podfile ended up looking like this:

platform :ios, '7.0'target 
'Unity-iPhone' do
pod 'Firebase/Analytics', '~> 3.10'
pod 'Firebase/Auth', '~> 3.10'
pod 'Firebase/Core', '~> 3.10'
pod 'Firebase/Messaging', '~> 3.10'
pod 'Firebase/RemoteConfig', '~> 3.10'
end

I then ran "pod install" in the same directory and that created the .xcworkspace file (this took some time, as it installed several prerequisites). Opening the .xcworkspace file, I was then able to successfully build and run my app. I've run into additional run time issues (which is why I was on StackOverflow today), but that at least got the project compiling.

You will need a copy of the GoogleServices-info.plist file into the app's xcode directory. Unity copied it automatically for me, but YMMV.

Hope this helps.

这篇关于Firebase Unity iOS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆