Opening the Settings app from another app

前端 未结 17 2563
傲寒
傲寒 2020-11-22 01:37

Okay, I know that there are many question about it, but they are all from many time ago.

So. I know that it is possible because the Map app does it.

In the M

17条回答
  •  感动是毒
    2020-11-22 02:09

    iOS 10 update

    Apple changed the method to open async on the main thread. However, from now it is only possible to open the app settings in native settings.

    [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];

    iOS 9 update

    It is now possible to go directly to sub-settings menu. However, a URL scheme has to be created. It can be done using two ways:

    1. XCode - You will find it in Target, Info, URL Scheme. Then, just type prefs.
    2. Directly adding to *-Info.plist. Add the following: CFBundleURLTypes CFBundleTypeRole Editor CFBundleURLSchemes prefs

    Then the code:

    Swift

    UIApplication.sharedApplication().openURL(NSURL(string:"prefs:root=General&path=Keyboard")!)

    Objective-c

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Keyboard"]];

提交回复
热议问题