Unable to connect with FCM. Optional(Error Domain=com.google.fcm Code=501

来源:互联网 发布:商业数据分析 编辑:程序博客网 时间:2024/05/21 15:44

Solution: open push notification and in backgroud mode open remote notification in Xcode 8

iOS 9.3

// [START connect_to_fcm]
func connectToFcm() {
//FIRMessaging.messaging().connect { (error) in
FIRMessaging.messaging().connectWithCompletion { (error) in
if (error != nil) {
print(“Unable to connect with FCM. (error)”)
} else {
print(“Connected to FCM.”)
}
}

}// [END connect_to_fcm]

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.

    connectToFcm() //add by Kevin}
0 0
原创粉丝点击