1
遵循Parse.com上的指南,瞭解如何創建證書並準備供應帳戶以接受推送通知。當我去首選項/帳戶:它顯示在底部,但是當我嘗試從生成設置選項卡中選擇它時,它不顯示,並且我總是得到此錯誤:"no valid 'aps-environment' entitlement string found for application"
Xcode,Parse.com - 推送通知不會顯示在我的手機上。
我的手機被識別解析應用程序,它會成功發送通知,但我的手機永遠不會收到它們。我從零開始嘗試了幾次,使用幾個Xcode & Parse Apps。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Parse.setApplicationId("MyAppId", clientKey: "MyAppClientKey")
var notificationType: UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationType, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
return true
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
var currentInstallation: PFInstallation = PFInstallation()
currentInstallation.setDeviceTokenFromData(deviceToken)
currentInstallation.saveInBackground()
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
println(error.localizedDescription)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
}