首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Twitter发送tweet失败,但我不知道为什么

使用Twitter发送tweet失败,但我不知道为什么
EN

Stack Overflow用户
提问于 2015-04-01 14:42:49
回答 1查看 743关注 0票数 2

我正在使用Twitter来登录和发推。验证它是可以的,但是当使用TWTRComposer和一个简单的文本时,SDK回调返回'TWTRComposerResultDone',但是模拟器/设备显示“tweet”文本无法发送,因为与Twitter的连接失败了。调试器显示'plugin com.apple.share.Twitter.post失效‘,但是一切都是完全正确的。

是不是有窃听器或者我忘了什么东西。

我的代码:

TWTRComposer *composer = [TWTRComposer alloc init]; 作曲家setText:@“一些文本”; 作曲家展示完整:^(TWTRComposerResult结果){ if ( == TWTRComposerResultCancelled) { NSLog(@"Tweet组合取消“);}NSLog{NSLog(@”发送Tweet!");};};

EN

回答 1

Stack Overflow用户

发布于 2015-12-07 13:21:50

使用SDK的Tweet

  1. twitter.developer上的Crearte应用程序
  2. 添加TwitterCore.framework、TwitterKit.framework、Fabric.framework、TwitterKitResources.bundle等twitter框架
  3. 用tweet按钮编写下面的代码
代码语言:javascript
复制
  [[Twitter sharedInstance] startWithConsumerKey:@"YourConsumerKey" consumerSecret:@"YourConsumerSecret"];
  [Fabric with:@[[Twitter sharedInstance]]];

  [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) 
  {
    if (session) 
    {
        NSLog(@"logged in user with id %@", session.userID);

        TWTRComposer *composer = [[TWTRComposer alloc] init];
        [composer setText:@"Enter Your Tweet Message"];
        //[composer setImage:[UIImage imageNamed:@"fabric"]];
        [composer showFromViewController:self completion:^(TWTRComposerResult result) {
            if (result == TWTRComposerResultCancelled) 
            {
                NSLog(@"Tweet composition cancelled");
            }
            else 
            {
                NSLog(@"Sending Tweet!");
                UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"Sent Tweet!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                [warningAlert show];
            }
        }];

    } 
    else 
    {
        // log error
    }
 }];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29393805

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档