0

I am trying to open the Settings app from my own iOS app. My code is in 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");
}];

This open URL method is the new method given by Apple. What should I pass in the options dictionary?

2 Answers 2

1

As you can see in 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.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this to open settings app

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.