这句话的意思是咱们在UIApplicationDelegate中实现了application:didReceiveRemoteNotification:fetchCompletionHandler:方法,但没有在Info.plist中的UIBackgroundModes添加remote-notification。以前作这个推送的同事说这个提示没有关系,一直都有这句提示的,并且咱们的推送功能一直是正常的。可是我内心仍是有些疑问,那就问问度娘吧。html
解决方案:网络
原文:http://www.cnblogs.com/yonggezai/p/4826713.htmlapp
极光推送官网给出的解答是:less
这句话主要是提示开发者若是要支持UIBackgroundModes,须要开启Remote notifications,具体操做能够看:iOS 7 Background Remote Notification。测试
看了半天,仍是没有理解Remote notifications有什么特色,后来在知乎上看到了一个问题“为何iOS伪后台,可是有不少软件也会在后台一直运行?”,有一个答案对remote notificaions解释的很清楚:fetch
推送唤醒(remote notifications)iOS7之前,当你收到推送消息时,你须要先打开应用,等待应用从网络上获取推送的信息以后,才能将信息呈现出来。而iOS7改变了这一过程。当系统收到推送消息时,不是首先提醒用户,而是唤醒对应的应用,让应用在后台获取对应的信息。当信息处理完成后,再提醒用户。一个很小的改变,可是能够很大的提高用户体验。一样,iOS系统也会限制这种推送消息的频率,防止系统被频繁唤醒影响续航。
——来自知乎网友Jeffrey Linthis
这个时候再结合那两张 Apple 官方对IOS6和iOS7对比的图片,就很容易理解了。spa
UIApplicationDelegate中提供了两个方法来处理推送的回调,其中第二个方法是iOS7之后才有的:日志
// 若是app在前台运行,系统收到推送时会调用该方法 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { } // 无论app是在前台运行仍是在后台运行,系统收到推送时都会调用该方法 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler { /* Use this method to process incoming remote notifications for your app. * Unlike the application:didReceiveRemoteNotification: method, * which is called only when your app is running in the foreground, * the system calls this method when your app is running in the foreground or background. }
这两个方法长得很像,可是职责不一样,。code
如今的问题是:
1.咱们实现了application:didReceiveRemoteNotification:fetchCompletionHandler:方法,但没有设置UIBackgroundModes的remote-notification,有什么影响吗?
2.既然有了application:didReceiveRemoteNotification:fetchCompletionHandler:方法,为何还要application:didReceiveRemoteNotification: 呢?
我测试了一下两个遗留问题:
1.咱们实现了application:didReceiveRemoteNotification:fetchCompletionHandler:方法,但没有设置UIBackgroundModes的remote-notification,有什么影响吗?
不设置UIBackgroundModes的remote-notification的话,除了推送唤醒功能不生效以外,没发现有其余影响。
2.既然有了application:didReceiveRemoteNotification:fetchCompletionHandler:方法,为何还要application:didReceiveRemoteNotification: 呢?
我看了API文档,是这么说的:
Implement the "application:didReceiveRemoteNotification:fetchCompletionHandler:" method instead of this one(application:didReceiveRemoteNotification:) whenever possible.
If your delegate implements both methods, the app object calls the "application:didReceiveRemoteNotification:fetchCompletionHandler:" method.
因此application:didReceiveRemoteNotification:方法应该是没用了。
转自 祥龙Shannon
原文:http://www.jianshu.com/p/9a25418ab84e