3

I am implementing Twitter in my iPhone application and if the user does not have any Twitter accounts set up, I would like him to be able to open his Twitter settings from my app. Is there any way to do this in iOS 5.1?

In iOS 5.0 we could do as below but I have not managed to find a way to do this in 5.1

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];
simonbs
  • 7,932
  • 13
  • 69
  • 115
  • I've answered this in a different question: http://stackoverflow.com/questions/11325266/open-twitter-setting-from-acaccountstore-ios-5-1-twitter/13293846#13293846 – Senior Nov 08 '12 at 17:00

2 Answers2

3

Try this..

 TWTweetComposeViewController *ctrl = [[TWTweetComposeViewController alloc] init];
        if ([ctrl respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) {
            // Manually invoke the alert view button handler
            [(id <UIAlertViewDelegate>)ctrl alertView:nil
                                 clickedButtonAtIndex:0];
        }
        [ctrl release];
  • Now this is what I'd like to call a hack. You could also just add a runtime override to `[UIApplication openURL:]`, which would probably be easier, and safer long-term. – Richard J. Ross III Mar 22 '13 at 13:23
  • @obj_developer, Wow! Totally Loved this hack :) My only concern is that Will this "opening of the Twitter settings from an app" be approved by Apple any more? Is this a valid concern? – defactodeity Mar 23 '13 at 05:08
  • @RichardJ.RossIII [UIApplication sharedApplication]openURL: it doesn't work in 5.1 – objc_developer Mar 28 '13 at 04:19
  • @objc_developer no; what I'm saying is that your back probably uses `-openURL:` in the background, so you override it and log out the URL that you can use normally. – Richard J. Ross III Mar 28 '13 at 04:26
1

I don't know the reason why but Apple has removed the settings apps URL Schemes. Yes it was working in iOS 5.0 but it doesn't work in 5.1

defactodeity
  • 714
  • 1
  • 8
  • 21