didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler未调用

时间:2016-09-19 06:28:58

标签: ios objective-c apple-push-notifications

我尝试推送通知并希望增加徽章编号,但

didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler   

未在非活动状态或背景状态下调用。

我目前在iOS 9和Xcode 7.3中工作。

2 个答案:

答案 0 :(得分:0)

检查一次是否启用

enter image description here

在调用该方法之后

  

didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler

同时检查this链接

答案 1 :(得分:0)

在通知有效内容中,您必须发送"content-available":1

此外,这篇博文将帮助您。 http://samwize.com/2015/08/07/how-to-handle-remote-notification-with-background-mode-enabled/