我有一个iOS应用程序,使应用程序启动(资源更新等)上的一些小的网络请求.如果用户在iOS设置中关闭了该应用的手机访问权限,则每次启动时,都会从iOS中获取有关网络使用情况的提示.有没有办法以编程方式知道这个应用的移动数据已经被禁用,所以我可以在启动时禁用请求?
解决方法
所以我在Apple工程师的苹果开发论坛(
https://devforums.apple.com/message/1059332#1059332)发现了这一点.
Another developer wrote in to DTS and thus I had a chance to
investigate this in depth. Alas,the news is much as I expected:
there is no supported way to detect that your app is in this state.
Nor is there a way to make a “no user interaction” network connection,
that is,request that the connection fail rather than present UI like
this. If these limitations are causing problems for your app,I
encourage you to file a bug describing your specific requirements.
07001
因此,您无法检测到您的应用的蜂窝数据是否已被关闭.
编辑
我提出了一个雷达,要求增加它.我刚才在这个雷达中收到了这个通知
We believe this issue has been addressed in the latest iOS 9 beta.
我看过API的差异,但到目前为止我找不到新的API.