3

If I access Twitter, I would prefer to use the automatic alert box asking that the user go to settings, yet can't get it to work and provide my own default dialog, which I really don't want to do.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSLog(@"indexPath.row %i", indexPath.row);

if (indexPath.row == 0) {

    store = [[ACAccountStore alloc] init]; // Long-lived

    twitterType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

    [store requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL granted, NSError *error) {

        if (granted) {
            // Access has been granted, now we can access the accounts

            twitterAccounts = [store accountsWithAccountType:twitterType];
            if (twitterAccounts.count == 1) {
                  [self getTwitterData:[twitterAccounts objectAtIndex:0]];

            } else {
                   [self selectTwitterAccount];
            }
        } else {
        // Prefer NOT to do this ************************************
        [self performSelectorOnMainThread:@selector(showTwitterError) withObject:nil waitUntilDone:NO];
        }

    }];
}
zachjs
  • 1,738
  • 1
  • 11
  • 22
Edward Potter
  • 3,760
  • 4
  • 28
  • 39

2 Answers2

1

To my knowledge this was only possible in iOS versions 5.0 - 5.0.1. It was then depreciated again in iOS 5.1

So NO solution at the moment...

In case you would like to use the iOS 5 part:

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

And some more reading on the same topic

Community
  • 1
  • 1
Frank
  • 16,476
  • 7
  • 38
  • 51
1

It is little tricky , i get by the removing the subviews in *TWTWeetComposeViewController*, so it shows only alert when user is not loged in and by the clicking on setting button , we can open the setting page in my app.

     + (void)setAlertForSettingPage :(id)delegate 
    {
     // Set up the built-in twitter composition view controller.
        TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];


        // Create the completion handler block.
        [tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
            [delegate dismissModalViewControllerAnimated:YES];
        }];

        // Present the tweet composition view controller modally.
        [delegate presentModalViewController:tweetViewController animated:YES];
        //tweetViewController.view.hidden = YES;
        for (UIView *view in tweetViewController.view.subviews){
            [view removeFromSuperview];
        }

     } 

Here, delegate is your viewcontroller, if you are using this method inside your viewcontroller just use self instead of delegate.

I had to face the same problem and found this sollution

Community
  • 1
  • 1
PJR
  • 13,052
  • 13
  • 64
  • 104