iOS 6 Social framework not going to settings or no alert

后端 未结 1 1218
别跟我提以往
别跟我提以往 2021-02-19 08:56

I\'m trying to implement the new social framework in iOS6, and have it working, except for 2 weird problems. If I\'ve enabled the services I\'m interested in (say... FaceBook),

1条回答
  •  眼角桃花
    2021-02-19 09:12

    I had the same problem, i fixed it by removing the If statement:

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    

    Then the view will display although there is no Facebook/Twitter account configured in the settings. And the "No Facebook/Twitter accounts" alertView showed! And I was able to hit the "Settings" button on the alert, and it directed me to the settings (Configure Facebook/Twitter account in the settings)

    This is the code I used, and it works perfectly for me:

    - (IBAction)bTwitter:(id)sender {
    
    mySLComposerSheet = [[SLComposeViewController alloc] init];
    
    mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
    
    [mySLComposerSheet setInitialText:@""];
    
    [mySLComposerSheet addImage:[UIImage imageNamed:@""]];
    
    [self presentViewController:mySLComposerSheet animated:YES completion:nil];
    
    }
    

    0 讨论(0)
提交回复
热议问题