解析:没有注册设备错误

Parse: No Registered Devices Error

我已经按如下方式设置了 Parse.com 的推送功能,但是当我尝试发送推送通知时 运行 遇到了问题:

  1. Certificates have been set up, signed, uploaded, etc.

  2. SDK has been imported as per the instructions here

  3. AppDelegate.swift has been edited to include the following:

 func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
    Parse.setApplicationId("MY KEY. I KNOW IT IS CORRECT", clientKey: "MY CLIENT KEY. ALSO VERIFIED TO BE CORRECT")


    let userNotificationTypes = (UIUserNotificationType.Alert |
        UIUserNotificationType.Badge |
        UIUserNotificationType.Sound);

    let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
    application.registerUserNotificationSettings(settings)
    application.registerForRemoteNotifications()

    return true
}


func application(application: UIApplication!, didReceiveRemoteNotification userInfo:NSDictionary!) {

        PFPush.handlePush(userInfo)



}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    let installation = PFInstallation.currentInstallation()
    installation.setDeviceTokenFromData(deviceToken)
    installation.saveInBackground()
}

但是,当我尝试通过在 Parse 仪表板中选择我的应用程序发送推送通知时,选择 "Push",然后选择“+ 发送推送”,我收到错误消息

No push notifications to display yet You may need to configure push notifications for your app.

我遇到了同样的问题,我把头撞在墙上想弄明白,直到我意识到当我进入 Parse 中的“推送通知”选项卡时,它以某种方式将我切换到另一个较早的应用程序我已经设置好了。确保您在左上角选择了正确的应用程序。希望您的解决方案和我的一样简单。