如何在iphone的twitter中发推文推文

时间:2011-10-04 12:13:26

标签: android iphone objective-c twitter tweets

当我达到最大字符限制时,我无法发送我的网址。

最多140个字符,它可以正常工作。

从130个字符开始,当我开始编写链接时,我收到了消息

Link will appear shortened

但我无法点击Tweet Button。相反,我在屏幕顶部收到一条消息

Your Tweet was over 140 characters. You'll have to be more clever

我已经检查了this link

由于

1 个答案:

答案 0 :(得分:4)

- (void)postOnTwitter
{
    //  You can take url with any length....
    NSString *shareLink = @"https://www.google.co.in/"
    //   text should be under 140 character size
    //   TEXT MUST BE END WITH "." dot.
    NSString *text = @"Heyyy... I am sharing Url with any length."
    NSString *tweetStr = [NSString stringWithFormat:@"%@ %@",text, shareLink];

    NSMutableDictionary *message = [[NSMutableDictionary alloc] initWithObjectsAndKeys:tweetStr,@"status", nil];

    NSURLRequest* request = [[[Twitter sharedInstance] APIClient] URLRequestWithMethod:@"POST" URL:@"https://api.twitter.com/1.1/statuses/update.json" parameters:message error:nil];

    [[[Twitter sharedInstance] APIClient] sendTwitterRequest:request     completion:^(NSURLResponse* response, NSData* data, NSError* error){
        if(!error)
        {
            //    Post successfully 
        }
        else if(error)
       {
            //   Check for Error
        }
    }];
}