-6

i want to open the iphone official settings from my app in the getinfo() function if the user is already login than there is no need to open the official setting of iphone if there is no user login the app open the official setting of iphone currently i am unable to open iphone setting.

 - (IBAction)twitterLogin:(id)sender {

        [self getInfo];

    }

        - (void) getInfo
        {
            // Request access to the Twitter accounts

            ACAccountStore *accountStore = [[ACAccountStore alloc] init];
            ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

            [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error){
                if (granted) {
                    GET_DEFAULTS
                    [defaults setInteger:1 forKey:kHasUserRemembered];
                    [defaults synchronize];
                     NSArray *accounts = [accountStore accountsWithAccountType:accountType];

                    ACAccount *twitterAccount = [accounts objectAtIndex:0];
                    GET_DBHANDLER
                    NSDictionary *tempDict = [[NSMutableDictionary alloc] initWithDictionary:
                                              [twitterAccount dictionaryWithValuesForKeys:[NSArray arrayWithObject:@"properties"]]];
                    NSString *tempUserID = [[tempDict objectForKey:@"properties"] objectForKey:@"user_id"];

                    NSLog(@"userid: %@", tempUserID);
                    userDC *user =  [dbHandler authenticate_User:twitterAccount.username andPassword: @"" andIsFB:0 AndIsTwitter:1];
                    [defaults setObject:tempUserID forKey:kHastwitterID];
                    [defaults synchronize];
                    [self gotoMainView];






                                   }
               else {


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

                    NSLog(@"No access granted");
                }
            }];

        }
iOS developer
  • 68
  • 2
  • 12
  • apple doesn't permit to access iPhone settings in your application. – Pratik Mar 29 '13 at 06:49
  • 1
    there's literally tons of questions about it. You spent more time posting your question then making a basic google search: https://www.google.com/search?q=open+ios+settings+from+app – Gabriele Petronella Mar 29 '13 at 06:50

1 Answers1

2

As stated in answers to several SO questions on the same subject:

This functionality was available briefly in iOS 5.0.x:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];

But has since been removed and is no longer possible.

Community
  • 1
  • 1
Elliott
  • 4,598
  • 1
  • 24
  • 39
  • 1
    *flag such duplicate questions instead of answering them.* – rohan-patel Mar 29 '13 at 10:23
  • @rohan-patel I did flag it, and there's no doubt the question will be closed but in the meantime if I can provide a direct answer that will help the OP I will. This website's top priority is helping people, keeping the records clean comes second. – Elliott Mar 29 '13 at 10:34
  • 1
    I do not agree helping people who do not search anything and directly post a question. *Answering such Help Vampires will encourage him/her and many others likewise to ask duplicate question, IMHO* – rohan-patel Mar 29 '13 at 10:41
  • 3
    @rohan-patel And you are entitled to your own opinion. But I ask, what is it you're concerned about? Is it that the OP will not learn to become self sufficient if we do not teach him to by purposely not answering his questions? If that is the case then I say who are we to govern how somebody does or doesn't learn. If your concern is the clutter of the website, as I've already stated, you needn't worry, the question will be closed and removed in due time. Either case is irrelevant with respect to your 'down vote', which i feel is unjustified. I think the OP will find my answer useful. – Elliott Mar 29 '13 at 10:51