iOS UIAlertView button to go to Setting App iOS UIAlertView button to go to Setting App ios ios

iOS UIAlertView button to go to Setting App


For example:

NSURL*url=[NSURL URLWithString:@"prefs:root=WIFI"];[[UIApplication sharedApplication] openURL:url];

And

[font=]About — prefs:root=General&path=AboutAccessibility — prefs:root=General&path=ACCESSIBILITYAirplane Mode On — prefs:root=AIRPLANE_MODEAuto-Lock — prefs:root=General&path=AUTOLOCKBrightness — prefs:root=BrightnessBluetooth — prefs:root=General&path=BluetoothDate & Time — prefs:root=General&path=DATE_AND_TIMEFaceTime — prefs:root=FACETIMEGeneral — prefs:root=GeneralKeyboard — prefs:root=General&path=KeyboardiCloud — prefs:root=CASTLEiCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUPInternational — prefs:root=General&path=INTERNATIONALLocation Services — prefs:root=LOCATION_SERVICESMusic — prefs:root=MUSICMusic Equalizer — prefs:root=MUSIC&path=EQMusic Volume Limit — prefs:root=MUSIC&path=VolumeLimitNetwork — prefs:root=General&path=NetworkNike + iPod — prefs:root=NIKE_PLUS_IPODNotes — prefs:root=NOTESNotification — prefs:root=NOTIFICATIONS_IDPhone — prefs:root=PhonePhotos — prefs:root=PhotosProfile — prefs:root=General&path=ManagedConfigurationListReset — prefs:root=General&path=ResetSafari — prefs:root=SafariSiri — prefs:root=General&path=AssistantSounds — prefs:root=SoundsSoftware Update — prefs:root=General&path=SOFTWARE_UPDATE_LINKStore — prefs:root=STORETwitter — prefs:root=TWITTERUsage — prefs:root=General&path=USAGEVPN — prefs:root=General&path=Network/VPNWallpaper — prefs:root=WallpaperWi-Fi — prefs:root=WIFI`prefs:root=INTERNET_TETHERING


Opening settings apps programmatically is possible only from iOS 8. So, use the following code...

if([CLLocationManager locationServicesEnabled]&&   [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied){  //...Location service is enabled}else{    if([[[UIDevice currentDevice] systemVersion] floatValue]<8.0)    {    UIAlertView* curr1=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];    [curr1 show];    }    else    {        UIAlertView* curr2=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil];        curr2.tag=121;        [curr2 show];    }}- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSLog(@"buttonIndex:%d",buttonIndex);   if (alertView.tag == 121 && buttonIndex == 1) {  //code for opening settings app in iOS 8   [[UIApplication sharedApplication] openURL:[NSURL  URLWithString:UIApplicationOpenSettingsURLString]]; }}


Apparently, this does not work in iOS 5.1 whatsoever. I have been fighting it all morning, and then ran across this blog

http://www.alexcurylo.com/blog/2011/11/04/settings-urls/