简体   繁体   English

ios中如何打开设置页面而不是App设置

[英]How to open settings page instead of App settings in ios

So I want to open settings page (VPN) and not app settings on iPhone所以我想打开设置页面 (VPN) 而不是 iPhone 上的应用程序设置

I stumbled upon this articles that talks about iOS URL schemas for App settings.我偶然发现这篇文章讨论了应用程序设置的 iOS URL 模式。

https://medium.com/p/20871139d72f https://medium.com/p/20871139d72f

Based on that, I added prefs to URL schema and then wrote this code基于此,我将prefs添加到 URL 模式,然后编写了这段代码

  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但这没有用,所以我使用App-Refs并将我的代码修改为

 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).此打开设置,但不是About (模拟器没有 Vpn)。

Can someone tell me how I can open VPN in settings on iOS.谁能告诉我如何在 iOS 的设置中打开VPN

Also, I read Apple rejects app if we use prefs .另外,我读到 Apple rejects app if we use prefs if that's the case, what's the point of having URL schema?如果是这样,那么拥有 URL 模式有什么意义呢?

Update: So VPN apps add VPN and can also open the VPN page in settings (sharkVpn) so I think it is possible?更新:所以 VPN 应用程序添加了 VPN,并且还可以在设置 (sharkVpn) 中打开 VPN 页面,所以我认为这是可能的?

This might be one of those scenarios where you have to put some UX around things rather than being able to automate things perfectly.这可能是您必须围绕事物放置一些 UX 而不是能够完美地自动化事物的场景之一。 Ask the user to do something in VPN settings, then have a Continue button.要求用户在 VPN 设置中做一些事情,然后有一个Continue按钮。

I seem to remember running into the same problem for a Swift app.我似乎记得在 Swift 应用程序中遇到过同样的问题。 In my case I wanted to ensure a prerequisite of a secured device before storing OAuth tokens in the device keychain.在我的例子中,我想在设备钥匙串中存储 OAuth 令牌之前确保安全设备的先决条件。

In my blog post I therefore presented the view in the Secured Device Prerequisite section.因此,在我的 文中,我在Secured Device Prerequisite部分介绍了该视图。 Nothing amazing in this answer, but at least you can unblock yourself, without anything that goes against Apple approval.这个答案没什么了不起的,但至少你可以解锁自己,没有任何违反苹果批准的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从iOS 8中的应用程序打开常规设置(不在应用程序设置中)? - How to open general settings (not in the app settings) from the app in iOS 8? 如何打开常规设置页面(主页,不是应用程序设置)? - How to open general settings page (home page, not app settings)? 从应用程序打开iOS设置 - Open iOS settings from the app iOS:13 位置始终允许:点击打开设置后,它不会重定向到应用程序设置页面 - iOS: 13 Location Always Allow: After tapping on Open Settings, it does not redirect to App Settings page Delphi FMX iOS 应用程序。 如何打开应用通知设置 - Delphi FMX iOS app. How to open app notifications settings 如何从另一个 App IOS 打开 Facebook 应用设置? - How to open Facebook app settings from another App IOS? 如何在iOS中以编程方式打开设置 - How to open settings programmatically in ios 如何在 iOS 8.0+ 中以编程方式打开设备设置应用程序而不是应用程序设置 - How to open device settings app not the app settings programmatically in iOS 8.0+ 以编程方式导航到iOS主要设置应用,而不是应用特定设置页面 - Programmatically navigate to iOS main settings app, not the app specific settings page 如何打开我的应用程序的iPhone设置页面? - How to open settings page of iphone throgh my app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM