2

I am trying to implement Twitter and Facebook into my app. Therefor I am using the integrated method in iOS, which is available since iOS 6, to do this. Under iOS 6, if there is no Facebook or Twitter configured an alarm view comes up to inform the user that he has to configure an account first to use Twitter or Facebook. The alarm view gives the user the option to jump directly to the settings of Twitter or Facebook. In iOS 7, if there is no account configured, no alarm view comes up to inform the user. Seems that has been disabled under iOS 7. So I am now inform the user myself but is there a way to point the user directly to the settings like it was under iOS 6? Or do I need to change my code under iOS 7 to get the alarm back?

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else {
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
        {
         //inform the user that no account is configured with alarm view.
        }

    }
halloway4b
  • 573
  • 1
  • 11
  • 23
  • http://stackoverflow.com/questions/3113391/iphone-opening-application-preferences-panel-from-app – Janub Dec 17 '13 at 11:34

2 Answers2

4

Just remove this line from your code and it will work correctly

 if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
Shabir jan
  • 2,295
  • 2
  • 23
  • 37
1

in ios 7, Try with removing this condition, it will tells user to if there is no account configured.

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else {
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
        { SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Hello a Tweet"];

        [self presentViewController:tweetSheet animated:YES completion:nil];


         //inform the user that no account is configured with alarm view.
        }

    }