【发布时间】:2014-09-25 21:00:56
【问题描述】:
iOS 8 中有一个新功能:使用推送通知来唤醒应用程序,这还可以让应用程序在后台刷新数据。如何使用此功能?
推送通知到达时,键“内容可用”的值为 1。但是,如果应用程序尚未在后台运行,则不会收到任何数据。为什么不呢?
【问题讨论】:
标签: ios cocoa-touch apple-push-notifications ios8
iOS 8 中有一个新功能:使用推送通知来唤醒应用程序,这还可以让应用程序在后台刷新数据。如何使用此功能?
推送通知到达时,键“内容可用”的值为 1。但是,如果应用程序尚未在后台运行,则不会收到任何数据。为什么不呢?
【问题讨论】:
标签: ios cocoa-touch apple-push-notifications ios8
这里有几件事,
1.U需要在Capabilities部分的目标的Background mode下检查Remote Notification on。
2.U需要实现下面的方法,
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
【讨论】: