Opening IOS settings preferences - iphone

Im having a problem opening the settings preferences in my IOS iphone app. At the moment im just using a simple button to test and it doesn't seem to be working correctly.
Basically when I click the button I want a specific settings preference page to open. This is what Im currently using within my buttons IBACTION:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
Hope you guys can help me out with a solution for this, thanks in advance.

try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
should work in iOS 5
... update:
opening with the prefs url was disabled in iOS 5.1
sebastian

Related

Open Setting App from my applicaiton in iPhone iOS 7

I want to open iphone default setting application form my application, Please any one tell me what I have to do. OR is there any code to open it.
I try following code but it dont works.in iOS 7.1.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=LOCATION_SERVICES_Systemservices"]];
Thanks in Advance.
For iOS8 and later use :
// Send the user to the Settings for this app
//iOS 8 only
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:settingsURL];
Since iOS 5.1, there is no official way to open Settings via App.
Here to Go.
You can use private API to open Settings App from your application. But i'm not sure if it will get accepted from apple.
void (*openApp)(CFStringRef, Boolean);
void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", 0);
openApp = dlsym(hndl, "SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.Preferences"), FALSE);
Swift 4
let url = URL(string: UIApplicationOpenSettingsURLString)
if UIApplication.shared.canOpenURL(url!) {
UIApplication.shared.openURL(url!)
}

Open Settings → Wifi from alert button action in iOS 5.1

I want to open Settings from my app's alertView button action with following URL Scheme.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General&path=Network"]];
It's working fine for iOS 5.0 but not for 5.1 and above.
Any alternate way to implement this?
Simply no. This URL scheme has been disabled by Apple in SDK 5.1. Its not possible without Jailbreak.
This feature is no more supported in iOS 5.1 and above. No direct way to do this.

Navigate to settings screen in iphone

I want to move from my app to settings screen of iphone when a button in the app is pressed. Can any one please help by telling how to do it? Any help is appreciated. Sorry for my bad english.
Thanks
prefs:root=General pattern no longer works for iOS Latest versions !!!
There is an update in it. The following works fine in iOS 8 ..
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
you may look at this
iOS Launching Settings -> Restrictions URL Scheme
Settings screen can be opened for versions less than IOS 5.0 as it has been disabled for latest IOS's. For Lower versions you can try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
MoreOver you should create your own view and present the editable settings to the user and get the input from him(for the first time or as a menu) and store it using NSUserdefaults.
You can't ask user to enter settings such as server-address port etc and try it each time, if it works.
I have found a solution for navigating from your application to Settings application which works fine iOS 8 or later versions
1) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
This will navigate to settings only if your app settings are absent
if they are present then the above code will navigate to Settings page of your app
I am using the below string to navigate to iCloud page and it works fine
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"App-Prefs:root=CASTLE"] options:#{} completionHandler:nil]
just by replacing the "CASTLE" with "GENERAL"

Access Settings app in iOS

Is there an opportinity to show up the settings.app in iOS by clicking on a button? It should work with iOS 5.1 so the "prefs:root..." url is no option.
Do you have an idea how to solve this?
I know the question is about 5.1 specifically, but in case anyone else is interested:
As of iOS 8, it is possible to take a user from your app directly into the Settings app. They will be deep linked into your app's specific Settings page, but they can back out into the top level Settings screen.
UPDATE:
Thanks to Pavel's comment, I simplified the if statement and avoided the EXC_BAD_ACCESS on iOS 7.
UPDATE 2:
If your deployment target is set to 8.0 or above, Xcode 6.3 will give you the following warning:
Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true
This is because the feature was available starting in 8.0, so this pointer will never be NULL. If your deployment target is 8.0+, just remove the if statement below.
if (&UIApplicationOpenSettingsURLString != NULL) {
NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:appSettings];
}
You are not able to do this on iOS 5.1. Most likely Apple removed that ability intentionally (you'll get "Please enter a valid URL", while Twitter can still call the Settings, though). Please refer to:
How to open preferences/settings with iOS 5.1?.
Apple Disables Home Screen Shortcuts For Settings Toggles In iOS 5.1
On iOS 8 Apple gave us the possibility to go to the App Settings right from our app
you can apply this code:
- (IBAction)openSettings:(id)sender {
BOOL canOpenSettings = (UIApplicationOpenSettingsURLString != NULL);
if (canOpenSettings) {
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
}
iOS6 shows an option to open the settings app directly from an 'AlertView' (shown automatically) if it detects if you're trying to post to FB or Twitter without having those accounts setup.
I have elaborated this over here
The method openURL: is now deprecated.
iOS 10 +
The correct way to open the settings URL (or any URL for that matter) is as follows:
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:settingsURL options:#{} completionHandler:^(BOOL success) {
// Do anything here
}];

iPhone: Opening Application Preferences Panel From App

Is it possible to open the application's preferences pane directly from the app, or will users be forced to to go through the Settings app?
The nicer alternative is to use InAppSettingsKit which does the replication for you. Apple wants everybody to use the Settings app though.
You can use this on iOS 5.0 - 5.0.1.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
It is possible now in iOS 8
if (&UIApplicationOpenSettingsURLString != NULL)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
They have to go through the Settings app.
An alternative is for you to replicate the settings within your application.