当iOS8.2,应用程序在后台运行,它不接受任何推送通知运行,CloudKit推送通知,应用程序在后台
它是在前台运行,而如果它收到推送通知罚款。
任何想法是怎么回事?
运行在CloudKit Development
模式,认购是添加,编辑和删除,并使用以下didReceiveRemoteNotification
:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"Push received.");
NSDictionary * apsDict = [userInfo objectForKey:@"aps"];
NSString * alertText = [apsDict objectForKey:@"alert"];
//TODO: get the record information from the notification and create the appropriate message string.
if(application.applicationState == UIApplicationStateActive) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Notification" message:alertText delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];
} else {
if([application currentUserNotificationSettings].types & UIUserNotificationTypeAlert) {
UILocalNotification * localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = NSLocalizedString(@"alert body", nil);;
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:2];
[application presentLocalNotificationNow:localNotification];
}
}
completionHandler(UIBackgroundFetchResultNoData);
}
嗨@Edwin yes后台提取和远程通知处于打开状态。还有什么明显的可能会被遗漏? – Porton
在您的订阅中,您是否为CKNotificationInfo发送alertBody或alertLocalizationKey?然后,您将已经从操作系统获得通知,并且不需要设置本地通知。但是,然后通知应该已经到达。特别是当你说他们到达应用程序活动时。 –
您是否注册过所有类型?在awnser中看到额外的评论 –