Opening the Settings app from another app
As mentioned by Karan Dua this is now possible in iOS8 using UIApplicationOpenSettingsURLString
see Apple's Documentation.
Example:
Swift 4.2
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
In Swift 3:
UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!)
In Swift 2:
UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)
In Objective-C
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Prior to iOS 8:
You can not. As you said this has been covered many times and that pop up asking you to turn on location services is supplied by Apple and not by the App itself. That is why it is able to the open the settings application.
Here are a few related questions & articles:
is it possible to open Settings App using openURL?
Programmatically opening the settings app (iPhone)
How can I open the Settings app when the user presses a button?
iPhone: Opening Application Preferences Panel From App
Open UIPickerView by clicking on an entry in the app's preferences - How to?
Open the Settings app?
iOS: You’re Doing Settings Wrong
Open Settings iOS 8 URL
the answer to this questions is NO, we can't open direct Location page ,but we can open UIApplicationOpenSettingsURLString
(settings page)
try this
if let appSettings = NSURL(string: UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(appSettings)
}
else
{
// your URL is invalid
}
for additional information
How to open settings from my iPad application (Objective-C)
Apple no longer allows developers to open the Settings application from within their apps (iOS 5.1 and later).
EDIT
According to @Mike's comment below, this can be done in iOS 8+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Using this prior to iOS 8 will result in a crash, however.
Call the official *Settings* app from my app on iPhone
Bad news: As @Hlung and @jasongregori suggested, for iDevices whose OS version >= iOS 5.1 && < iOS 8.0, there is once again NO official/documented way to call the built-in Settings app from a third-party app. Period.
Open Settings app from another app programmatically in iPhone
Good news :
You can open settings apps programmatically like this (works only from iOS8 onwards).
If you are using Swift 3.0:
UIApplication.shared.open(URL(string: UIApplicationOpenSettingsURLString)!)
If you are using Objective-C:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
For other lower versions (less than iOS8) its not possible to programatically open the settings app.
Access iOS settings from code
No. In general, you can read your own app's preferences (whether they're set via the Settings app or by your app) using NSUserDefaults. You cannot, however, read the preferences for other applications, including system settings. There may be cases where you can figure out what the setting must be by using API specific to that setting, but in such cases you still shouldn't assume that you know what selection the user has made in the Settings app.
How to open Settings programmatically like in Facebook app?
You can't, there is no API call to do this.
Only system dialogs, dialogs from Apple Frameworks, can open the settings app.
In iOS 5 there was a app url scheme to open the system dialog but Apple removed it later.
With the coming of iOS 8 you can open the settings dialog on your apps page.
if (&UIApplicationOpenSettingsURLString != NULL) {
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
else {
// Present some dialog telling the user to open the settings app.
}
Related Topics
How to Use Uiviewcontrolleranimatedtransitioning with Uinavigationcontroller
Drawing Gradient Over Image in iOS
Share Video on Twitter with Fabric API Without Composer iOS
Not Receiving Any Push Notification in Iphone
Create Ssl Connection Using Certificate
Why Is Swiftui Picker in Form Repositioning After Navigation
Get Current iOS Device Orientation Even If Device's Orientation Locked
Dispatchqueue Crashing with Main.Sync in Swift
View Controller Responds to App Delegate Notifications in iOS 12 But Not in iOS 13
Uitableviewcell Selected Background Color on Multiple Selection
How to Play Movie with a Url Using a Custom Nsurlprotocol
How to Animate an Svg Path in iOS
Orienting iOS Splash Image to Landscape/Portrait According to Launch Orientation
Find Size Contributed by Each External Library on iOS
Property Cannot Be Found in Forward Class Object