在单个应用程序中使用Firebase的不同项目-Swift

时间:2019-05-15 21:49:16

标签: ios swift firebase

我正在尝试在我的应用程序中初始化多个Firebase项目,但是该应用程序仅收到有关第一个配置的通知。

这是相似的,但不是更新。 [类似问题] [1]

这是我的代码。

//Configure first service firebase
let filePath1 = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist")
guard let fileopts1 = FirebaseOptions(contentsOfFile: filePath1!)
else { assert(false, "Couldn't load config file") }
FirebaseApp.configure(name: "first", options: fileopts1)

//Configure second service firebase
let filePath = Bundle.main.path(forResource: "GoogleService-Cuarto", ofType: "plist")
guard let fileopts = FirebaseOptions(contentsOfFile: filePath!)
else { assert(false, "Couldn't load config file") }
FirebaseApp.configure(options: fileopts)

Messaging.messaging().delegate = self

if #available(iOS 10.0, *) {
    // For iOS 10 display notification (sent via APNS)
    UNUserNotificationCenter.current().delegate = self

    let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
    UNUserNotificationCenter.current().requestAuthorization(
    options: authOptions,
    completionHandler: {_, _ in })
} else {
    let settings: UIUserNotificationSettings =
    UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
    application.registerUserNotificationSettings(settings)
}

application.registerForRemoteNotifications()

但是我在firebase中的项目没有检测到我的应用。

救救我!

0 个答案:

没有答案