1 objective-c geolocation cllocationmanager ios
我需要打开我的iOS应用程序特定位置设置.我知道我们可以通过以下方式打开常规位置设置:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root = LOCATION_SERVICES"]];*
我有两个问题:
以上是否有效且根据Apple指南(或)是否应该打开设置应用程序并允许用户更改设置?
我的要求是打开我的应用程序的特定位置设置 - 显示"始终","使用应用程序","从不",以便用户可以修改相同的位置设置.这可能吗
提前致谢.
对于Swift 3及更高版本: 此外,Code还会检查ios版本并完成所有版本的工作.
if let url = URL(string: UIApplicationOpenSettingsURLString){
if #available(iOS 10.0, *){
UIApplication.shared.open(url, completionHandler: nil)
print("\n--- in ios 10 ")
} else{
UIApplication.shared.openURL(url)
print("\n--- in ios other than 10 ")
}
}
Run Code Online (Sandbox Code Playgroud)
UIApplicationOpenSettingsURLString:基本上打开您的应用程序的设置,它还显示应用程序使用的所有服务,包括位置服务,移动数据,照片库等...
现在可可键添加到plist文件您的应用程序,即这里有一些网址的 可可键iOS的10,可可钥匙从developer.apple
| 归档时间: |
|
| 查看次数: |
2153 次 |
| 最近记录: |