ios - 基本 Swift 3 应用程序因 Firebase 崩溃

标签 ios swift firebase

我正在 iOS 中开始使用 Firebase,在阅读 Firebase 文档并对我的应用进行初步设置后,它无法在模拟器中运行。

错误如下:

2017-01-16 10:56:08.058 Thread[18978:1562804] Firebase automatic screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO in the Info.plist
2017-01-16 10:56:08.062808 Thread[18978:1562850] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2017-01-16 10:56:08.064832 Thread[18978:1562850] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2017-01-16 10:56:08.072334 Thread[18978:1562846] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2017-01-16 10:56:08.083044 Thread[18978:1562804] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
(lldb) 

这是我的 AppDelegate.swift 的当前状态(仅针对设置 Firebase 进行了更改)

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        FIRApp.configure()
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

FIRApp.configure() 挂起

最佳答案

您是否已将“GoogleService-Info.plist”添加到 bundle 中?

您必须捆绑 GoogleService-Info.plist,然后只有库才能自动查找位置并使用它。

关于ios - 基本 Swift 3 应用程序因 Firebase 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41680439/

相关文章:

ios - 如何修复 AWSCognito 代码中的 "domainnsposixerrordomain code13 permission denied"运行时错误?

iphone - 如何禁用 iOS 系统声音

ios - TableView 在 Swift 中丢失选定的行

ios - 快速相机覆盖 View

ios - 从另一个选项卡返回到根 Controller

ios - UIImageView调整大小消除空白IOS

ios - 如何在 Swift 中的 UITextField 上应用手机号码模式

android - Firebase 崩溃报告控制台 - 如何使用打开/关闭过滤器?

node.js - 如何异步使用 Nodemailer 和 Firebase 向多个用户发送邮件

javascript - 如何向 Firebase Firestore 添加多个路径?