- (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
}
}];
}
你在自己的代码遇到此? – rckoenes
我猜这个twitter会使用't.co'缩短你的链接,但是即使是缩短版本也要超过10个字符。你应该写出更短的推文 – thomas
@rckoenes我们可以在130条文字后写出url – Hitarth