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");
}
}];
}