无法为Unity IOS配置Firebase应用。

问题描述 投票:0回答:1

我不断地在周围寻找,却找不到任何解决方法。我用Unity构建了我的IOS项目,编译得很好。我只是得到运行时的错误,我似乎根本无法解决。

当我用Unity测试模式运行时,它运行得很好,(没有错误和配置加载)。

当我在IOS设备上编译运行时,就会出现一堆运行时错误,我甚至无法通过加载界面,因为Firebase无法加载。

最上面的只是所有的dupe错误(有两个以上,但我只包括例子),最下面的是 "无法配置Firebase应用 "的错误。

另外:我在Windows上使用IOS Project Builder构建项目,所以我手动添加了&链接了框架。我无法添加FirebaseApp.configure bc我不是在swift上。

Mon 11 23:48:33.974 RemoteConsole <stderr>: objc[11431]: Class FIRAnalyticsConnector is implemented in both /private/var/containers/Bundle/Application/0080BEB1-979B-48A5-AFE9-F25C7FD60E6D/cashcrates.app/cashcrates (0x10240a3b8) and /private/var/containers/Bundle/Application/0080BEB1-979B-48A5-AFE9-F25C7FD60E6D/cashcrates.app/Frameworks/UnityFramework.framework/UnityFramework (0x10624fd10). One of the two will be used. Which one is undefined.
Mon 11 23:48:33.974 RemoteConsole <stderr>: objc[11431]: Class FIRConnectorUtils is implemented in both /private/var/containers/Bundle/Application/0080BEB1-979B-48A5-AFE9-F25C7FD60E6D/cashcrates.app/cashcrates (0x10240a408) and /private/var/containers/Bundle/Application/0080BEB1-979B-48A5-AFE9-F25C7FD60E6D/cashcrates.app/Frameworks/UnityFramework.framework/UnityFramework (0x10624fd60). One of the two will be used. Which one is undefined.


Mon 11 23:48:34.115 RemoteConsole <stderr>: 2020-05-11 23:48:34.333 cashcrates[11431:2281069] Built from '2019.3/staging' branch, Version '2019.3.12f1 (84b23722532d)', Build type 'Release', Scripting Backend 'il2cpp'
Mon 11 23:48:34.193 RemoteConsole <stderr>: 2020-05-11 23:48:34.411 cashcrates[11431:2281069] GfxDevice: creating device client; threaded=1
Mon 11 23:48:34.193 RemoteConsole <stdout>: CrashReporter: initialized
Mon 11 23:48:34.193 RemoteConsole <stdout>: -> applicationDidFinishLaunching()
Mon 11 23:48:34.193 RemoteConsole <stdout>: -> applicationDidBecomeActive()
Mon 11 23:48:34.193 RemoteConsole <stdout>: GfxDevice: creating device client; threaded=1
Mon 11 23:48:34.236 RemoteConsole <stderr>: 2020-05-11 23:48:34.412 cashcrates[11431:2281069] Initializing Metal device caps: Apple A12 GPU
Mon 11 23:48:34.236 RemoteConsole <stderr>: 2020-05-11 23:48:34.413 cashcrates[11431:2281069] Initialize engine version: 2019.3.12f1 (84b23722532d)
Mon 11 23:48:34.236 RemoteConsole <stdout>: Initializing Metal device caps: Apple A12 GPU
Mon 11 23:48:34.236 RemoteConsole <stdout>: Initialize engine version: 2019.3.12f1 (84b23722532d)
Mon 11 23:48:34.334 RemoteConsole <stdout>: CrashReporter: No pending report exists at /var/mobile/Containers/Data/Application/5CC73465-87AF-475C-BE86-AE7993321E3B/Library/Caches/CrashReports/crash-pending.plcrash
Mon 11 23:48:34.334 RemoteConsole <stderr>: 2020-05-11 23:48:34.552 cashcrates[11431:2281069] CrashReporter: No pending report exists at /var/mobile/Containers/Data/Application/5CC73465-87AF-475C-BE86-AE7993321E3B/Library/Caches/CrashReports/crash-pending.plcrash
Mon 11 23:48:34.387 RemoteConsole <stderr>: 2020-05-11 23:48:34.576 cashcrates[11431:2281069] Unbalanced calls to begin/end appearance transitions for <SplashScreenController: 0x135d62c30>.
Mon 11 23:48:36.368 RemoteConsole <stdout>: UnloadTime: 2.304417 ms
Mon 11 23:48:36.368 RemoteConsole <stderr>: 2020-05-11 23:48:36.579 cashcrates[11431:2281069] UnloadTime: 2.304417 ms
Mon 11 23:48:36.413 RemoteConsole <stdout>: Fetching data...
Mon 11 23:48:36.413 RemoteConsole <stdout>: Config:FetchDataAsync()
Mon 11 23:48:36.413 RemoteConsole <stdout>: Config:Start()
Mon 11 23:48:36.413 RemoteConsole <stdout>: 
Mon 11 23:48:36.413 RemoteConsole <stdout>: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Mon 11 23:48:36.413 RemoteConsole <stdout>: 
Mon 11 23:48:36.413 RemoteConsole <stderr>: 2020-05-11 23:48:36.627 cashcrates[11431:2281069] Fetching data...
Mon 11 23:48:36.413 RemoteConsole <stderr>: Config:FetchDataAsync()
Mon 11 23:48:36.413 RemoteConsole <stderr>: Config:Start()
Mon 11 23:48:36.413 RemoteConsole <stderr>: 
Mon 11 23:48:36.413 RemoteConsole <stderr>: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Mon 11 23:48:36.413 RemoteConsole <stderr>: 
Mon 11 23:48:36.429 RemoteConsole <stderr>: 2020-05-11 23:48:36.641 cashcrates[11431:2281069] ERROR: Unable to configure Firebase app (The default FirebaseApp instance must be configured before the defaultFirebaseApp instance can be initialized. One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).)
Mon 11 23:48:36.429 RemoteConsole <stderr>: 2020-05-11 23:48:36.645 cashcrates[11431:2281069] Uploading Crash Report
Mon 11 23:48:36.429 RemoteConsole <stderr>: 2020-05-11 23:48:36.646 cashcrates[11431:2281069] InitializationException:  Firebase app creation failed.
Mon 11 23:48:36.429 RemoteConsole <stderr>:  at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.429 RemoteConsole <stderr>:   at Config.FetchDataAsync () [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.429 RemoteConsole <stderr>:  at Config.Start () [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.429 RemoteConsole <stderr>: 
Mon 11 23:48:36.429 RemoteConsole <stderr>: (Filename: currently not available on il2cpp Line: -1)
Mon 11 23:48:36.429 RemoteConsole <stderr>: 
Mon 11 23:48:36.429 RemoteConsole <stderr>: 2020-05-11 23:48:36.647 cashcrates[11431:2281069] Unable to configure Firebase app (The default FirebaseApp instance must be configured before the defaultFirebaseApp instance can be initialized. One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).)
Mon 11 23:48:36.429 RemoteConsole <stderr>: Firebase.AppUtil:PollCallbacks()
Mon 11 23:48:36.429 RemoteConsole <stderr>: Firebase.Platform.FirebaseHandler:Update()
Mon 11 23:48:36.429 RemoteConsole <stderr>: 
Mon 11 23:48:36.429 RemoteConsole <stderr>: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Mon 11 23:48:36.429 RemoteConsole <stderr>: 
Mon 11 23:48:36.457 RemoteConsole <stdout>: Uploading Crash Report
Mon 11 23:48:36.457 RemoteConsole <stdout>: InitializationException: Firebase app creation failed.
Mon 11 23:48:36.457 RemoteConsole <stdout>:   at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.457 RemoteConsole <stdout>:  at Config.FetchDataAsync () [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.457 RemoteConsole <stdout>:   at Config.Start () [0x00000] in <00000000000000000000000000000000>:0 
Mon 11 23:48:36.457 RemoteConsole <stdout>:  
Mon 11 23:48:36.457 RemoteConsole <stdout>: (Filename: currently not available on il2cpp Line: -1)
Mon 11 23:48:36.457 RemoteConsole <stdout>: 
Mon 11 23:48:36.457 RemoteConsole <stdout>: Unable to configure Firebase app (The default FirebaseApp instance must be configured before the defaultFirebaseApp instance can be initialized. One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).)
Mon 11 23:48:36.457 RemoteConsole <stdout>: Firebase.AppUtil:PollCallbacks()
Mon 11 23:48:36.457 RemoteConsole <stdout>: Firebase.Platform.FirebaseHandler:Update()
Mon 11 23:48:36.457 RemoteConsole <stdout>:  
Mon 11 23:48:36.457 RemoteConsole <stdout>: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
ios windows firebase unity3d
1个回答
0
投票

如果你不能使用Unity,这就有点棘手了。Unity的外部依赖管理器(EDM4U)但看起来你的问题可能是缺少GoogleService-Info.plist。一般来说,这将作为EDM4U运行的一部分自动复制过来,但由于你绕过了这一点,你将会想要手动完成它。配置步骤应该在调用 FirebaseApp.DefaultInstance (或初始化任何其他依赖它的单子)。

你可以尝试将文件放在 Assets/StreamingAssets 看看是否能解决这个问题,否则你就得把它移到手动连接框架的地方。请看 这个 如果你需要重新下载它。

如果这还不能解决,请确保你已经遵循了 iOS上手指南 (听起来你已经这样做了)。不要害怕使用CocoaPods。EDM4U就是这样做的.

另外,不要忽略unity bundles下的文件。Assets/Plugins/iOS/Firebase (前。Assets/plugins/iOS/Firebase/libFirebaseCppApp.a). 我知道,很多时候版本控制系统都会排除掉 .a 文件,以避免跟踪构建工件。这些文件大致映射到 C++ SDK,Firebase Unity SDK使用它与底层框架进行通信。C#层主要使用 SWIG 来生成适当的绑定,并做一些额外的工作,使其更方便在Unity中使用。

最后,虽然我不认为从Windows中生成iOS项目有广泛的测试,但我可以看到有一些需求。如果能提交一个bug询问这个问题,会很有帮助的 此处并概述你到目前为止不得不颁布的变通办法。同时提交一份 功能要求 是一个很好的方式来鼓动支持(这适用于任何找到这个答案的人,而不仅仅是OP--噪音越大越好)。

如果有帮助,请告诉我

--◎帕特里克

© www.soinside.com 2019 - 2024. All rights reserved.