Job*_* Sá 5 push-notification apple-push-notifications ios
我有一个可以接收远程通知并执行后台任务的应用程序。我已经建立了Background Modes用于Background fetch和Remote notifications我可以接收通知和执行后台正常获取时,应用程序是前景或背景。
问题是当应用程序被杀死时 - 通知不显示,甚至不在通知中心,或者作为横幅,警报等。我知道,如果应用程序被杀死,它将无法执行后台拿来。但我认为它至少应该显示通知。
在AppDelegate我已经实现了这两种方法:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Run Code Online (Sandbox Code Playgroud)
和
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
Run Code Online (Sandbox Code Playgroud)
我正在使用此注册通知:
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我我身边可能有什么问题/遗漏吗?
| 归档时间: |
|
| 查看次数: |
435 次 |
| 最近记录: |