0

最近我让它工作了,但现在它突然停止了。按钮被按下时什么都不做。代码甚至没有给出断点或错误。怎么了?

下载项目 (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];
    }
}
4

1 回答 1

1

在您的故事板中,您的第一个场景的类设置为ViewController,但实际上它显然应该是您项目中包含的类之一,例如Tab1_ViewController

于 2013-02-21T23:16:19.267 回答