好吧,我已经花了昨天的一半,今天上午的一半搜索板和Google以及Firebase Docs的解决方案。只是要清楚。FireBase iOS消息传递,无法获取APNS令牌
我已经FirebaseAppDelegateProxyEnabled设置为NO,我info.plist中,我会后我的appDelegate方法,但我已经通过文档看了很多次:
didFinishLaunchingWithOptions:
customizeAppearance()
FIRApp.configure()
tracker.appLaunch()
registerForPushNotifications(application)
notificationCenter.addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotification), name: kFIRInstanceIDTokenRefreshNotification, object: nil)
return PersistentStoreManager.sharedInstance.managedObjectContextHasBeenInitialized()
didReceiveRemoteNotification:
//Full message
print("%@", userInfo)
articleID = "\(userInfo["articleId"]!)"
notificationCenter.postNotificationName("newArticle", object: nil)
registerForPushNotifications:
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
application.registerForRemoteNotifications()
didRegisterForRemoteNotificationsWithDeviceToken:
//send the APNs token to firebase
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Sandbox)
print("In did register For remote Not with token: \(FIRInstanceID.instanceID().token())")
}
tokenRefreshNotification:
let refreshedToken = FIRInstanceID.instanceID().token()!
//send token information to server
self.manager.sendNotificationToken(refreshedToken)
//double check to connect to FCM, may have failed when attempted before having a token
connectToFcm()
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print("Failed to register:", error.description)
}
控制台登录:
WARNING: Firebase Analytics App Delegate Proxy is disabled. To log deep link campaigns manually, call the methods in FIRAnalytics+AppDelegate.h.
Configuring the default app.
<FIRAnalytics/INFO> Firebase Analytics v.3201000 started
<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
<FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "The operation couldn’t be completed. (com.firebase.iid error 1001.)"
<FIRMessaging/INFO> FIRMessaging library version 1.1.0
[4459:501] <FIRAnalytics/INFO> Firebase Analytics enabled
CFNetwork SSLHandshake failed (-9806)
2016-07-28 10:26:08.245: <FIRInstanceID/WARNING> APNS Environment in profile: development
In did register For remote Not with token: Optional("fWmrxcdNICg:APA91bF_pVwLixBXFuRZEF0w64J7zizSQfpaYNjJhf9g95fZxDmqKD-I1gnaxufkmbNvGZZKs8ifL6ZlXY9nWBc0utgVjEBJG7tUNnA8ciOzeyW9wtfSHyq0IYIf4OepJ4qTJf8qLpIR")
In did register For remote Not with token: Optional("fWmrxcdNICg:APA91bF_pVwLixBXFuRZEF0w64J7zizSQfpaYNjJhf9g95fZxDmqKD-I1gnaxufkmbNvGZZKs8ifL6ZlXY9nWBc0utgVjEBJG7tUNnA8ciOzeyW9wtfSHyq0IYIf4OepJ4qTJf8qLpIR")
而且我瞄准的iOS 8.3及以上。我已将我的开发和产品推送通知证书上传到Firebase中。
我有断点设置,我的tokenRefreshNotification()不会被调用而且也不didReceiveRemoteNotification()
我不知道发生了什么错误的,我想给应用程序发送到应用程序商店星期一。我昨天大部分时间都收到了通知,然后他们停了下来。我没有从Firebase控制台或Web服务服务器获取它们。