解析:没有注册设备错误

时间:2015-02-19 17:47:21

标签: ios swift parse-platform push-notification apple-push-notifications

我已经设置了Parse.com的Push功能如下,但是当我尝试发送推送通知时遇到了一个问题:

  
      
  1. 证书已设置,签名,上传等

  2.   
  3. 已根据instructions here

  4. 导入SDK   
  5. AppDelegate.swift已经过编辑,包括以下内容:

  6.   
 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仪表板中选择我的应用程序来发送推送通知,选择“推送”,然后选择“+发送推送”时,我收到错误

  

尚未显示推送通知   您可能需要为应用配置推送通知。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,并且把头撞到了墙上一段时间试图解决这个问题,直到我意识到当我去Parse的推送通知选项卡时,它以某种方式将我转换为另一个我之前的应用程序建立。确保您在左上角选择了正确的应用程序。希望你的解决方案就像我的一样简单。