ios - 通过自定义应用程序在 iOS 10.1 中打开设置应用程序

标签 ios settings

我正在尝试从我自己的 iOS 应用程序打开“设置”应用程序。 我的代码是用 Objective-C 编写的。

UIApplication *app=[UIApplication sharedApplication];
NSURL *url=[NSURL URLWithString:UIApplicationOpenSettingsURLString]; 
NSDictionary *dict=[[NSDictionary alloc] initWithObjectsAndKeys:[[NSNumber alloc] initWithBool:YES],UIApplicationOpenURLOptionUniversalLinksOnly, nil];

[app openURL:url options:dict completionHandler:^(BOOL success) {
    NSLog(@"in open Url");
}];

这个打开URL的方法是Apple给出的新方法。我应该在选项字典中传递什么?

最佳答案

如您在 iOS SDK 中所见:

Options are specified in the section below for openURL options. An empty options dictionary will result in the same behavior as the older openURL call, aside from the fact that this is asynchronous and calls the completion handler rather than returning a result. The completion handler is called on the main queue. So you can just send nil to get behaviour of old openURL: method.

关于ios - 通过自定义应用程序在 iOS 10.1 中打开设置应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40972259/

相关文章:

iphone - CAAnimations,并更新图层树

ios - 按下主页按钮并再次重新启动应用程序时动画不起作用

python - scrapy startproject不使用指定的TEMPLATES_DIR来生成项目settings.py

使用 Terraform 和 map 的多个源的 Azure Function AppSettings

git - Android Studio git commit 看不到我修改过的文件

django - 新创建的 Pydev Django 项目不包括带有 Settings.py 等的初始包

ios - 在 objective-c 中,当呈现新场景时,如何去除旧场景?

android - 使用Flutter将文本基线与列内的文本对齐

iphone - 如何触发 UISearchBar 中的取消按钮?

Eclipse Luna Dark主题,语法着色重置。如何禁用?