2011-10-04 720 views
0

当我达到最大字符数限制时,我无法发布我的网址。如何在twitter中推特网址iphone

多达140个字符,它工作正常。

从130个字符,当我开始写的链接,我得到的消息

Link will appear shortened

,但我不能点击Tweet Button。相反,我在屏幕

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

的顶部得到一个消息,我已经检查this link

感谢

+0

你在自己的代码遇到此? – rckoenes

+0

我猜这个twitter会使用't.co'缩短你的链接,但是即使是缩短版本也要超过10个字符。你应该写出更短的推文 – thomas

+0

@rckoenes我们可以在130条文字后写出url – Hitarth

回答

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