iOS端从后台进入前台socket怎么重连

 我来答
地瓜说机
2017-09-05 · TA获得超过2.9万个赞
知道大有可为答主
回答量:2.3万
采纳率:91%
帮助的人:1.2亿
展开全部
直接看sdk头文件即可。

/*! This delegate method offers an opportunity for applications with the "remote-notification" background mode to fetch appropriate new data in response to an incoming remote notification. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost.

This method will be invoked even if the application was launched or resumed because of the remote notification. The respective delegate methods will be invoked first. Note that this behavior is in contrast to application:didReceiveRemoteNotification:, which is not called in those cases, and which will not be invoked if this method is implemented. !*/
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_AVAILABLE_IOS(7_0);

说得很清楚了,这货是ios7中引入的,如果实现了这货,那原先的版本- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo NS_AVAILABLE_IOS(3_0);就不会被调用。
这货被调用后,你唯一可做的就是执行你的后台代码,然后调用completionHandler(your_result);
你得到的警告就是因为你没调用completionHandler。
至于这里能干吗哪些,我没实际做过,但估计只能搞点网络之类。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式