简体   繁体   English

FireBase iOS消息传递,无法获取APNS令牌

[英]FireBase iOS Messaging, fails to fetch APNS Token

Ok, I have spent half of yesterday and half of this morning searching the boards and Google, and Firebase Docs for the solution. 好的,我花了昨天的一半时间和今天早上的一半时间在董事会和Google以及Firebase Docs上搜索解决方案。 Just to be clear. 只是要清楚。

I have FirebaseAppDelegateProxyEnabled set to NO in my info.plist, i'll post my appDelegate methods, but I have looked through the docs many times: 我在info.plist中将FirebaseAppDelegateProxyEnabled设置为NO,我将发布我的appDelegate方法,但是我已经浏览了很多文档:

didFinishLaunchingWithOptions: didFinishLaunchingWithOptions:

    customizeAppearance()
    FIRApp.configure()

    tracker.appLaunch()

    registerForPushNotifications(application)
    notificationCenter.addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotification), name: kFIRInstanceIDTokenRefreshNotification, object: nil)

    return PersistentStoreManager.sharedInstance.managedObjectContextHasBeenInitialized()

didReceiveRemoteNotification: didReceiveRemoteNotification:

    //Full message
    print("%@", userInfo)


    articleID = "\(userInfo["articleId"]!)"
    notificationCenter.postNotificationName("newArticle", object: nil)

registerForPushNotifications: registerForPushNotifications:

    let notificationSettings = UIUserNotificationSettings(
        forTypes: [.Badge, .Sound, .Alert], categories: nil)
    application.registerUserNotificationSettings(notificationSettings)
    application.registerForRemoteNotifications()

didRegisterForRemoteNotificationsWithDeviceToken: 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: 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)
}

Console Log: 控制台日志:

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")

And I am targeting iOS 8.3 and up. 我的目标是iOS 8.3及更高版本。 I have both my development and prod push notification certs uploaded into Firebase as well. 我也将开发和产品推送通知证书都上传到了Firebase中。

I have breakpoints set, my tokenRefreshNotification() doesn't get called and neither does didReceiveRemoteNotification() 我设置了断点,我的tokenRefreshNotification()没有被调用,并且didReceiveRemoteNotification()也没有

I don't know what is going wrong, and I am suppose to send the application to the app store Monday. 我不知道出了什么问题,我想星期一将应用程序发送到应用程序商店。 I was getting notifications fine most of the day yesterday, and then they stopped. 昨天大部分时间我都收到通知,然后它们停了下来。 I don't get them from the Firebase console or from our web service servers. 我没有从Firebase控制台或我们的Web服务服务器上获得它们。

OK I found my problem. 好的,我发现了我的问题。 Incase someone else runs into this problem I wanted to post the solution. 如果有人遇到这个问题,我想发布解决方案。 Be sure to check your code signing identities and provisioning profiles. 确保检查您的代码签名身份和配置文件。 I'm not sure how mine changed yesterday, however whenever I fixed these code signing settings my push notifications came in great, I haven't missed one yet. 我不确定昨天是否发生了什么变化,但是,每当我修复这些代码签名设置时,我的推送通知就大功告成了,我还没有错过任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检测真正的 iOS/APNS 推送令牌何时注册到 Firebase 云消息传递 (FCM)? - How can I detect when the real iOS/APNS push token is registered with Firebase Cloud Messaging (FCM)? 适用于Cordova app的Firebase - 无法获取APNS令牌 - Firebase for Cordova app - Failed to fetch APNS token APNS Firebase通知无法获取令牌 - APNS Firebase Notification failed to fetch token Firebase Cloud Messaging将消息发送到IID导入的Apns令牌 - Firebase Cloud Messaging send message to iid imported Apns token Firebase推送通知iOS问题,无法获取APNS令牌错误Domain = com.firebase.iid代码= 1001“(null)” - Firebase Push Notification iOS issue, Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 “(null)” iOS SwuftUI - 获取 firebase 消息传递用户令牌 - iOS SwuftUI - get firebase messaging user token APNS iOS设备令牌 - APNS iOS device token 在iOS Firebase Cloud Messaging(FCM)中,将APNS发送到主题,但发送方不是来自iPhone - In iOS Firebase Cloud Messaging (FCM), send APNS to topic but other than sender from iphone Firebase(FCM)无法获取APNS令牌错误域= com.firebase.iid代码= 1001 - Firebase (FCM) Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 Firebase无法获取APNS令牌错误域= com.firebase.iid代码= 1001“(null)” - Firebase Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 “(null)”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM