title: iOS programatic Cellular Data Control
body: <p>Is there a way to programmatically access the &quot;Cellular Data&quot; options that are sometimes shown in apps?</p>
  <h3>Background</h3>
  <p>I have an application that uploads data files over the internet.  I have given users the option of disabling this upload functionality when not connected to WiFi.</p>
  <h3>How</h3>
  <p>What I'm currently doing is I wrote a <code>settings.bundle</code> that allows the user to select an option called <strong>User Cellular Data</strong> in my code I am using a <code>Reachability.swift</code> file from (<a href="https://github.com/ashleymills/Reachability.swift" rel="nofollow noreferrer">https://github.com/ashleymills/Reachability.swift</a>) - which is a swift wrapper around the reachability iOS api - basically it can tell you if there is Wifi or cellular network access.</p>
  <h3>My code</h3>
  <p>In my code before doing uploads I check a NSUserDefaults value (as set by the <code>settings.bundle</code>)</p>
  <pre><code>let uploadOverCellular = NSUserDefaults.standardUserDefaults()
                           .boolForKey(&quot;allow_upload_over_cellular&quot;)
  </code></pre>
  <p>If this is true and I have either Wifi or Cellular internet I allow the upload to proceed.  If this is not true and I have cellular internet I stop the upload.</p>
  <p>So this is working nicely and then suddenly I was looking in the settings for my app and I noticed that I have both the <strong>System</strong> level <strong>Cellular Data</strong> option as well as my custom <strong>Use Cellular Data</strong> option. showing up</p>
  <p><a href="https://i.stack.imgur.com/kKFkN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kKFkN.png" alt="enter image description here" /></a></p>
  <h2>Question</h2>
  <p>Obviously this <em>could</em> cause some confusion for users - I wanted to know if there Is there API access to this system level <strong>Cellualr Data</strong> option - or some other way to control this setting programmatically - I suspect there is not but I'm hoping somebody can prove me wrong.</p>