【问题标题】:Crashing when using Firebase in iMessage extension在 iMessage 扩展中使用 Firebase 时崩溃
【发布时间】:2017-01-26 11:04:35
【问题描述】:

我正在尝试在具有 iMessage 扩展程序的 iOS 应用中使用 Firebase。我已包含 GoogleService-Info.plist 文件,并且能够在主机应用程序中正确使用 Firebase。

但是,当我在 iMessage 应用程序扩展中包含以下代码时:

override func willBecomeActive(with conversation: MSConversation) {
    super.willBecomeActive(with: conversation)
    if(FIRApp.defaultApp() == nil){
       FIRApp.configure()
    }
}

应用程序在运行时崩溃并出现以下错误

Could not locate configuration file: 'GoogleService-Info.plist'.

*** Terminating app due to uncaught exception 'com.firebase.core', reason:
'[FIRApp configure] could not find a valid GoogleServices-Info.plist in your project. 
Please download one from https://console.firebase.google.com/.'

我需要做什么才能在 iMessage 应用扩展中使用 Firebase?

【问题讨论】:

  • 您的错误可能是您将获得的最大帮助...确保已包含GoogleService-Info.plist
  • 你说得对,我没有将它添加到扩展目标中!谢谢

标签: ios objective-c swift firebase imessage


【解决方案1】:

确保在 File Inspector 中为 Target Membership 选中了相应的 Target 框。我已经在所附图像中删除了应用程序名称,但这是您应该寻找的。确保您的GoogleServices-Info.plist 文件被选中,然后选中相应的目标成员资格框。您的 Target Membership 的具体细节可能与您在下面看到的有所不同,但您至少需要检查其中一项。

【讨论】:

    【解决方案2】:

    你也可以复制plist文件并粘贴到带有扩展名的文件夹中,问题是该文件不能被扩展访问,它只能被主应用访问。

    【讨论】:

      猜你喜欢
      • 2019-02-21
      • 2017-11-15
      • 2017-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多