So I want to open settings page (VPN) and not app settings on iPhone
I stumbled upon this articles that talks about iOS URL schemas for App settings.
https://medium.com/p/20871139d72f
Based on that, I added prefs
to URL schema and then wrote this code
NSURL *url = [NSURL URLWithString:@"prefs:root=General&path=About"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
but this didn't work, So I worked with App-Refs
and modified my code to this
NSURL *url = [NSURL URLWithString:@"App-Prefs:root=General&path=About"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
This open setting, but not the About
(simulator doesn't have Vpn).
Can someone tell me how I can open VPN
in settings on iOS.
Also, I read Apple rejects app if we use prefs
. if that's the case, what's the point of having URL schema?
Update: So VPN apps add VPN and can also open the VPN page in settings (sharkVpn) so I think it is possible?
This might be one of those scenarios where you have to put some UX around things rather than being able to automate things perfectly. Ask the user to do something in VPN settings, then have a Continue
button.
I seem to remember running into the same problem for a Swift app. In my case I wanted to ensure a prerequisite of a secured device before storing OAuth tokens in the device keychain.
In my blog post I therefore presented the view in the Secured Device Prerequisite
section. Nothing amazing in this answer, but at least you can unblock yourself, without anything that goes against Apple approval.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.