Correct way to retrieve token for FCM - iOS 10 Swift 3

前端 未结 15 2326
日久生厌
日久生厌 2021-01-31 02:42

i had implement Firebase with FirebaseAuth/FCM etc and did sent notification successfully through Firebase Console.

However i would need to push the notification from m

15条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 02:54

    Swift 4 + Firebase (5.3.0)

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        InstanceID.instanceID().instanceID(handler: { (result, error) in
            if let error = error {
                print("Error fetching remote instange ID: \(error)")
            } else if let result = result {
                print("Remote instance ID token: \(result.token)")
            }
        })
    }
    

提交回复
热议问题