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

前端 未结 15 2050
日久生厌
日久生厌 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 03:07

    Swift 4

    Courtesy of: https://stackoverflow.com/a/50945350/1014164

    InstanceID.instanceID().instanceID { (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)")
        }
    }
    

提交回复
热议问题