SLCOmposeviewcontroller twitter 分享提醒问题 [英] SLCOmposeviewcontroller twitter sharing alert issue

查看:33
本文介绍了SLCOmposeviewcontroller twitter 分享提醒问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用此代码发推特.

I have been using this code for twitter posting .

SLComposeViewController *fbController=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];


if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
    SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){

        [fbController dismissViewControllerAnimated:YES completion:nil];

        switch(result){
            case SLComposeViewControllerResultCancelled:
            default:
            {
                NSLog(@"Cancelled.....");

            }
                break;
            case SLComposeViewControllerResultDone:
            {
                NSLog(@"Posted....");
                UIAlertView *alertView = [[UIAlertView alloc]
                                          initWithTitle:@"Success"
                                          message:@"Posted Successfully"
                                          delegate:self
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
                [alertView show];

            }
                break;
        }};

    [fbController addImage:[UIImage imageNamed:@"1.jpg"]];
    [fbController setInitialText:@"Check out this article."];
    //[fbController addURL:[NSURL URLWithString:@"http://soulwithmobiletechnology.blogspot.com/"]];
    [fbController setCompletionHandler:completionHandler];
    [self presentViewController:fbController animated:YES completion:nil];
}

如果用户没有设置 Twitter 帐户,它会显示带有设置和取消按钮的警报.但它没有在设备中显示警报?任何人都可以帮助我.提前致谢.

If the user doesn't setup the twitter account it is displaying the alert which is having the setting and cancel buttons . But it is not displaying the alert in the Device? Could any one help me please . Thanks in advance .

推荐答案

同样的事情发生在 Facebook 分享上.删除测试:

The same thing happens with Facebook sharing. Remove the test:

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])

如果用户的 Twitter 帐户尚未在 iOS 6 中设置,则上述测试将评估为 false,并且不会执行任何共享代码.

If the user's Twitter account isn't already set up in iOS 6, the above test will evaluate to false and none of the sharing code will execute.

相反,如果您跳过检查并尝试显示 SLComposeViewController,iOS 将提示用户设置他们的 Twitter 帐户.

Instead, if you skip the check and try to present the SLComposeViewController anyway, iOS will prompt the user to set up their Twitter account.

这篇关于SLCOmposeviewcontroller twitter 分享提醒问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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