2

Using Swift in an iOS 10 app, we can open the iPhone WiFi settings using this code:

let url = NSURL(string: "App-Prefs:root=WIFI")!
UIApplication.sharedApplication().openURL(url, options: [:], completionHandler: nil)

Is this allowed by Apple? I haven't been able to find a clear answer online. Please offer a link to Apple documentation if you can.

Luke
  • 7,110
  • 6
  • 45
  • 74
  • Luke, let me know if the linked duplicate answers your question. Otherwise ping me and I will reopen your question. – JAL Feb 27 '17 at 20:18
  • 1
    If you read the duplicate you can see that it is written in the sections that this is not officially supported by Apple. Apple will reject apps that access private URL schemes, however, some Apps slip through, but they will be taken down when noticed. You can read more on Apple forum about this: https://forums.developer.apple.com/thread/49664 , long story short, No you are not allowed to do that. This is what you are allowed to use as far as the settings goes: https://developer.apple.com/reference/uikit/uiapplicationopensettingsurlstring –  Feb 27 '17 at 20:21
  • @JAL the linked question does not provide a definitive answer, just some discussion about whether this works and is allowed. – Luke Feb 28 '17 at 14:10
  • @Sneak that forum thread similarly has some discussion around this but no definitive answer that I can see. That documentation link does not discuss specific URLs as far as I can see. Can you provide an Apple source that indicates that "Apple will reject apps that access private URL schemes"? – Luke Feb 28 '17 at 14:12
  • The way I see it is that the linked duplicate shows an undocumented way to access device settings. Generally speaking, Apple does not document everything that isn't allowed, but has in the past stated that using undocumented or provide APIs is grounds for rejection. I'll look for an official source that says that for you. – JAL Feb 28 '17 at 14:31
  • 1
    @JAL Got it right here https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899 luke "Any Apple URL schemes that are not officially documented should be considered private API" –  Feb 28 '17 at 16:30
  • 1
    @Sneak, awesome, thanks. The thread you quoted is the confirmation I was looking for (https://forums.developer.apple.com/thread/65007). Feel free to put that in an answer and I'll accept it. – Luke Feb 28 '17 at 16:58
  • @Luke Yeah sorry I forgot to paste the source of the quote lol. great :) This is marked as a duplicate I can add it to the original question in the duplicate no worries. –  Feb 28 '17 at 17:01

0 Answers0