我如何知道我的iOS应用程序的蜂窝访问是否被禁用? [英] How do I know if cellular access for my iOS app is disabled?

查看:222
本文介绍了我如何知道我的iOS应用程序的蜂窝访问是否被禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS应用程序,可以在应用程序启动(资源更新等)上发出一些小型网络请求。如果用户在iOS设置中关闭应用程序的蜂窝访问权限,则每次启动时都会从iOS获取有关网络使用情况的提示。有没有办法以编程方式知道此应用程序的蜂窝数据已被禁用,以便我可以在启动时禁用请求?

I have an iOS app that makes some small network requests on app launch (resource updates, etc). If the user turns off cellular access for the app in iOS Settings, they get a prompt from iOS about network usage every time they launch. Is there a way to know programmatically that cellular data for this app has been disabled, so that I can disable the requests at startup?

推荐答案

所以我在苹果工程师的苹果开发论坛上发现了这个问题( https://devforums.apple .com / message / 1059332#1059332 )。

So I found this on the apple dev forums from an Apple engineer (https://devforums.apple.com/message/1059332#1059332).


另一位开发人员写入DTS,因此我有机会获得
深入研究这个问题。唉,这个消息和我预期的一样:
没有支持的方法来检测你的应用是否处于这种状态。
也没有办法建立无用户交互网络连接,
即请求连接失败而不是像
这样呈现UI。如果这些限制导致您的应用程序出现问题,我会鼓励您提交描述您特定要求的错误。

https://developer.apple.com/bug-reporting/

因此,似乎无法检测您的应用的移动数据是否已关闭。

So it looks like it is not possible to detect if cellular data for your app has been turned off.

修改

我为此提交了一份雷达请求将其添加。我刚收到此通知

I filed a radar for this requesting that it be added. I just got this notification in my radar


我们认为此问题已在最新的iOS 9测试版中得到解决。

We believe this issue has been addressed in the latest iOS 9 beta.

我查看了API差异,但到目前为止我找不到新的API。

I looked through the API diffs, but so far I can't find the new API.

这篇关于我如何知道我的iOS应用程序的蜂窝访问是否被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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