Can you change Iphone's Privacy Settings programmatically in iOS7 or iOS8

I have an app which uses location services and background app refresh, I want to include these 2 preferences in my own app's Settings page so that the User can do this in one place rather than going to settings App.

Is it possible in iOS7 or iOS8? I know a few apps which are doing this.

Answers


The initial Alert which will prompt to get location service for an app is triggered by the OS and not by the App. This will be triggered as you would have enabled location based settings in your application.

But if the user deny it for the first time, according to the OS the user prefer to deny the location service for that particular app and this is users privacy. As Apple is very much concerned about user’s privacy settings, for user to accept those settings again, they should explicitly enable it again from the settings App and it is not possible to achieve it from app level. Because its nothing to do with the app and its purely OS based, and as a developer we cannot override it.

Instead we can detect the users current privacy setting for location, and if status in not having access, then you may prompt user an alert on which user may directly change the settings after navigating to settings app.

if([CLLocationManager locationServicesEnabled]){

    if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:ICLocalizedString(@"LocationServicesPermissionTitle")
                                                message:ICLocalizedString(@"LocationPermissionGeoFenceMessage")
                                               delegate:self
                                      cancelButtonTitle:@"Settings"
                                      otherButtonTitles:nil];
        [alert show];
    }
}

UIAlertView delegate:

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{
    [alertView dismissWithClickedButtonIndex:buttonIndex animated:YES];
    [[UIApplication sharedApplication] openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]];
}

Need Your Help

node.js shell environment variable conflict with cakephp

shell cakephp node.js

I have set cakes environment path in my .profile file, but it seems the

Check if JTextField contains only letters or numbers

java regex swing validation jtextfield

I have a JTextField where the user can type anything. What is a convenient way to check if the String of TextField.getText() does contain letters or numbers only? Basically I just want to avoid any...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.