只要互联网连接可用,就会将数据发送到服务器 [英] Send data to server whenever internet connection is available iOS

查看:147
本文介绍了只要互联网连接可用,就会将数据发送到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发iOS应用程序,

I am developing an iOS app,

我想做的是,每当用户通过设置应用程序打开/关闭他的互联网时,我想设置一些通知设备。

What i want to do is, whenever user turned on/off his internet from setting app, i want to set some notification to device.

简而言之,我想在互联网连接可用时将一些数据(存储在NSUserDefaults中)发送到服务器(假设互联网连接出现在2 3之后)天...)可能?

请提前帮助和谢谢。

推荐答案

试试这个Apple示例:
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html

Try this Apple example: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html

如果你想要这个当应用程序在后台尝试后台任务

If you want this to work when app in background try background task

如果您的应用程序未在后台暂停,请查看以下内容:
http://www.raywenderlich.com/29948/backgrounding-for-ios

If you what your app doesn't suspend in background look at this: http://www.raywenderlich.com/29948/backgrounding-for-ios

这篇关于只要互联网连接可用,就会将数据发送到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆