本文介绍了如何在iOS10上跳至系统设置的位置服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我问这个问题之前,我已经尝试过:

Before I asked this question I had try:

  1. 使用 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root = Privacy& path = LOCATION"]]; 在iOS8和iOS9上都可以正常使用,但没有任何反应在iOS10上.
  2. 使用 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; 在iOS8和iOS9上也可以正常使用.但是,在iOS10上,当应用程序跳转到系统设置时,系统设置立即退出.
  3. 使用 [[UIApplication sharedApplication] openURL:url选项:@ {} completionHandler:nil]; 在iOS8和iOS9上均已崩溃,并且在iOS10上立即退出.
  1. Use [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Privacy&path=LOCATION"]];It's work fine on iOS8 and iOS9,but there is nothing happen on iOS10.
  2. Use [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];It's work fine on iOS8 and iOS9,too.However,on iOS10,when the app jump to system setting, the system setting exit immediately.
  3. Use [[UIApplication sharedApplication]openURL:url options:@{}completionHandler:nil];It's crashed on iOS8 and iOS9,also,exit immediately on iOS10.

问题是我们的应用程序可以跳转到iOS10上的系统设置吗?如果是,怎么办?对于 [[UIApplication sharedApplication] openURL:url options:@ {} completionHandler:nil]; 什么是 options 表示什么?我们必须为 options ?

The question is can our app jump to system setting on iOS10? If yes.How?And for [[UIApplication sharedApplication]openURL:url options:@{}completionHandler:nil];what's the optionsmeans?We must code something for the options?

推荐答案

注意:我使用这种方法很长时间,一切进展顺利,但是今天(2018-9-14),我被拒绝了.

这是我以前的回答,请不要永远使用此方法:

Here is my previous answer,do not use this method forever:

CGFloat systemVersion = [[UIDevice currentDevice].systemVersion floatValue];
if (systemVersion < 10) {
 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Privacy&path=LOCATION"]];
}else{
 [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"App-Prefs:root=Privacy&path=LOCATION"]
                                          options:[NSDictionary dictionary]
                                completionHandler:nil];
}


现在我用这种方式:


Now I use this way:

if (@available(iOS 10.0, *)) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:[NSDictionary dictionary] completionHandler:nil];
} else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}

这篇关于如何在iOS10上跳至系统设置的位置服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 11:55