Facebook和放大器;微博分享按钮停止工作 [英] Facebook & Twitter share button stopped working

查看:185
本文介绍了Facebook和放大器;微博分享按钮停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我有工作,但现在它只是停无章可循。按钮一筹莫展的时候,他们是pressed。 Thhe code甚至不给断点或错误。什么是错的?

下载项目(3.2MB)

   - (IBAction为)ShareFB
{
    如果([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    {
        slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        [slComposeViewController addImage:[UIImage的imageNamed:@标志-carrito.png]];
        [slComposeViewController addURL:[NSURL URLWithString:@http://www.google.com]];
        [自presentViewController:slComposeViewController动画:是完成:NULL];
    }
    其他{
        UIAlertView中*警报= [[UIAlertView中页头] initWithTitle:@没有FB账户的消息:@有没有登记FB帐户配置之一。代表:无cancelButtonTitle:@DissmissotherButtonTitles:无];
        [警报显示]
    }
} - (IBAction为)ShareTW
{
    如果([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [slComposeViewController addImage:[UIImage的imageNamed:@标志-carito.png]];
        [slComposeViewController addURL:[NSURL URLWithString:@http://www.google.com]];
        [自presentViewController:slComposeViewController动画:是完成:NULL];
    }
    其他{
        UIAlertView中*警报= [[UIAlertView中页头] initWithTitle:@无TW账户的消息:@。有没有TW帐户注册配置一代表:无cancelButtonTitle:@辞退otherButtonTitles:无];
        [警报显示]
    }
}


解决方案

在你的故事板,你的第一个场景都有其类设置为的ViewController ,但实际上它应该明显包含在你的项目,如类之一 Tab1_ViewController

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];
    }
}

解决方案

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.

这篇关于Facebook和放大器;微博分享按钮停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆