所以这只会增加我在最新的iOS8 beta版更新中遇到的众多问题。我的应用程序使用解析来发送推送通知正常工作。它在我的手机和iOS7模拟器上运行良好。但是现在我根本没有收到通知。 Parse说我的手机仍在注册。控制台给我错误“在iOS 8.0及更高版本中不支持registerForRemoteNotificationTypes:”。这是可以理解的,但我相信我的代码解决了这个问题,直到这次更新为止。我注意到在运行模拟器时,如果我的应用程序被删除,然后我再次在模拟器中运行该程序。没有出现对话框询问我是否要接受推送通知,而是自动设置它以便接受它们,它也在我的手机上进行。作为旁注,这可能是更新的错误,因为我的其他推送通知今天已经从其他应用程序延迟/随机。不过我会很高兴有人看一下代码来检查。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:252/255.0f green:230/255.0f blue:17.0/255.0f alpha:1.0]];
[[UIToolbar appearance] setBarTintColor:[UIColor colorWithRed:252/255.0f green:230/255.0f blue:17.0/255.0f alpha:1.0]];
[Parse setApplicationId:@"***"
clientKey:@"***"];
// Register for push notifications
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
#ifdef __IPHONE_8_0
//Right, that is the point
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
#else
//register to receive notifications
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
#endif
return YES;
}
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
//handle the actions
if ([identifier isEqualToString:@"declineAction"]){
}
else if ([identifier isEqualToString:@"answerAction"]){
}
}
#endif
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken {
// Store the deviceToken in the current installation and save it to Parse.
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:newDeviceToken];
[currentInstallation saveInBackground];
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
}
更新:我在Parse中创建了一个新的应用程序,并将应用程序ID等复制到其中(缺少设置它的证书阶段,因为它们不会改变吗?)现在即使应用程序在设置中说它是注册接收通知,再次没有要求)Parse说它不是。
答案 0 :(得分:0)
不知道怎么回事?为什么?但推动已经开始重新开始。 Haven没有改变上面的任何设置,所以如果有人正在寻找使用解析的解决方案,这显然是有效的!
答案 1 :(得分:0)
要让iOS8接收推送通知,请看一下: Not able to set Interactive Push Notifications on iOS8
推送通知正在工作并显示,但交互式按钮无效。
我认为有与该类别有关的东西..
如果有人发现了什么,请更新。