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

前端 未结 15 2026
日久生厌
日久生厌 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:02

    Go with the second option, and this is going to seem really stupid/simple, but to fix that nil optional fatal error, just remove the force-unwrap at the end

    Your code:
    var token = FIRInstanceID.instanceID().token()!
    Make it:
    var token = FIRInstanceID.instanceID().token()

    That will at least fix that nasty crash

提交回复
热议问题