iphoneobjective-clocationios5.1

Open iPhone settings through code not working in iOS 5.1.1


i tried these commands-

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];    
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Wallpaper"]];    
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Safari"]];

These codes opens Location, General, Wallpaper and Safari respectively in iOS 5.0 but nothing works in iOS 5.1.1 Anyone have any idea?


Solution

  • In iOS 5.1, the prefs: URL scheme has been removed. You can't use it anymore.

    If using private APIs is an option, you can try this:

    SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.Preferences"), false);
    

    You have to link against the SpringBoardServices framework then.