iosnetwork-programmingcellular-network

How do I know if cellular access for my iOS app is disabled?


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?


Solution

  • So I found this on the apple dev forums from an Apple engineer (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.
    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.

    Edit

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

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

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