As of July 2018, it seems that Apple do not accept anymore the usage of App-Prefs:root
URL scheme. Please read below before marking as duplicate, because many answers are outdated or inappropriate.
DESCRIPTION OF PROBLEM I currently show an alert to ease the user to activate location at the phone level. This is a strong user experience issue. That is, Settings -> Privacy -> Location Services
Unfortunately, my app has been rejected be cause I use the non-public APIs URL scheme App-Prefs:root=LOCATION_SERVICES
I understand that I cannot use this non public scheme but what is the alternative ??
Indeed, when I deactivated location and I open the apple « maps » application, it opens the locations settings that is targeted by the illegal scheme. (The same goes for google map) if Apple or Google engineers still manage to open the phone location settings, then it means that there is a supported approach for doing so.
Other apps that manage to get direct access to location services at phone level:
- ZARA (Inditex Company)
- Life 360
- Find Friends (Apple Company)
Outdated or inappropriate answers suggest:
- using app-settings:root // It opens my own app settings
- using UIApplicationOpenSettingsURLString // The same 1.
- using App-Prefs:root // prefs:root // The same issue as mine
- deleting the peace of code using the // Too bad for user experience
for 1. and 2. Please see the screenshot that shows how the current answers are inappropriate:
Please find below the message for the Binary Rejected:
Your app uses the "prefs:root=" non-public URL scheme, which is a private entity. The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.
Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.
I filled also a request with the Apple Developer Technical Support today.
STEPS TO REPRODUCE
This peace of code below will now be rejected by apple when reviewing binaries.
func showAlertGeo() {
let alertController = UIAlertController (title: "Location not active", message: "To use all the feature of this app, please activate location on your phone.", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: nil)
alertController.addAction(cancelAction)
let settingsAction = UIAlertAction(title: "Settings", style: .default) { (_) -> Void in
if UIApplication.shared.canOpenURL(URL(string:"App-Prefs:root=LOCATION_SERVICES")!) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string:"App-Prefs:root=LOCATION_SERVICES")!, completionHandler: nil)
} else {
// Fallback on earlier versions
UIApplication.shared.openURL(URL(string:"App-Prefs:root=LOCATION_SERVICES")!)
}
}
}
alertController.addAction(settingsAction)
present(alertController, animated: true, completion: nil)
}