Facebook & Twitter share button stopped working [closed]

亡梦爱人 提交于 2019-12-25 09:40:59

问题


Recently I had it working, but now it just stopped out of nowhere. The buttons do nothing when they are pressed. Thhe code doesn't even give breakpoint or errors. What is wrong?

Download Project (3.2mb)

- (IBAction)ShareFB
{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    {
        slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        [slComposeViewController addImage:[UIImage imageNamed:@"logo-carrito.png"]];
        [slComposeViewController addURL:[NSURL URLWithString:@"http://www.google.com"]];
        [self presentViewController:slComposeViewController animated:YES completion:NULL];
    }
    else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No FB Account" message:@"There are no FB account registered. Configure one" delegate:nil cancelButtonTitle:@"Dissmiss" otherButtonTitles:nil];
        [alert show];
    }
}

- (IBAction)ShareTW
{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [slComposeViewController addImage:[UIImage imageNamed:@"logo-carito.png"]];
        [slComposeViewController addURL:[NSURL URLWithString:@"http://www.google.com"]];
        [self presentViewController:slComposeViewController animated:YES completion:NULL];
    }
    else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No TW Account" message:@"There are no TW accounts registered. Configure one." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
        [alert show];
    }
}

回答1:


In your storyboard, your first scene has its class set to ViewController, but in actually it should obviously be one of the classes included in your project, e.g. Tab1_ViewController.



来源:https://stackoverflow.com/questions/15011741/facebook-twitter-share-button-stopped-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!