我已经设置了Parse.com的Push功能如下,但是当我尝试发送推送通知时遇到了一个问题:
证书已设置,签名,上传等
- 导入SDK
- 醇>
AppDelegate.swift已经过编辑,包括以下内容:
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仪表板中选择我的应用程序来发送推送通知,选择“推送”,然后选择“+发送推送”时,我收到错误
尚未显示推送通知 您可能需要为应用配置推送通知。
答案 0 :(得分:0)
我遇到了同样的问题,并且把头撞到了墙上一段时间试图解决这个问题,直到我意识到当我去Parse的推送通知选项卡时,它以某种方式将我转换为另一个我之前的应用程序建立。确保您在左上角选择了正确的应用程序。希望你的解决方案就像我的一样简单。