Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone- Open Settings from my application iOS 6

I know there are many questions related to this.

1) is it possible to open Settings App using openURL?

2) Opening the Settings app from another app

3) iOS Launching Settings -> Restrictions URL Scheme

I have followed these questions for reference but that does not solve my query. I know that using openURL method you can open Settings but that was valid for only iOS 5.0 - 5.0.1. In iOS 5.1 it was deprecated.

  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]]; 

Still I have been seeing lot of Apps mainly location based which asks for user permission to turn on Location Services and takes directly to Location Services under Settings--> Privacy. The screenshot of an App, which is installed on iOS 6.1 running device, below shows that tapping on Settings take you to directly Location Services.

I tried to run code in my App but it is not working (I want to take user to Settings page to allow my app to access contact information directly from my App). If Apple has disabled URL Schemes for this how come many Apps are still using it?

enter image description here

like image 865
rohan-patel Avatar asked Mar 28 '13 12:03

rohan-patel


People also ask

How do I get to the iOS app settings?

Access the iOS Settings from the App Library To access the App Library, swipe left on your Home Screen until you reach it. Locate the gray gear Settings icon in the iPhone App Library and tap on it.


2 Answers

For apps that tie into services such as Location, the first time they request access the OS will throw out the alert with buttons that link to Settings. This isn't actioned by the app, but by the underlying security of the OS.

iOS 6 removed the ability to do this yourself as you mentioned.

like image 57
Cocoadelica Avatar answered Sep 22 '22 03:09

Cocoadelica


You can open settings app programmatically in iOS8, but not in earlier versions of iOS.

In Swift:

UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString));

Swift 4:

if let url = NSURL(string: UIApplicationOpenSettingsURLString) as URL? {
    UIApplication.shared.openURL(url)
}

In Objective-C

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
like image 28
Rajneesh071 Avatar answered Sep 22 '22 03:09

Rajneesh071