我正在尝试从我自己的 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 oldopenURL:
method.
关于ios - 通过自定义应用程序在 iOS 10.1 中打开设置应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40972259/