如何分享内容到Twitter。 如题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 - (void) postToTwitter{ // Since this will be launched in a separate thread, we need // an autorelease pool NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString:@"http://TWITTER_ACCOUNT:[email protected]/statuses/update.xml"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]; // The text to post NSString *msg = @"testing"; // Set the HTTP request method [request setHTTPMethod:@"POST"]; [request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg] dataUsingEncoding:NSASCIIStringEncoding]]; NSURLResponse *response; NSError *error; if ([NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error] != nil) NSLog(@"Posted to Twitter successfully."); else NSLog(@"Error posting to Twitter."); // Release pool [pool release]; } 请教一个关于xcode下fopen的问题 防盗犬 求教。关于在AppDelegate中使用UITabBarController的问题 cocos2d如何删除本层 请问这个定时器的使用错在哪里? ios一次请求失败,再次请求一直无法连接,严重bug! 大神解答——蓝牙后台,推送 怎么获取某个APP的CPU和内存占用 iOS 用webvie加载 PDF ios10.1.1加载不出来 紧急求助!!!(概率闪退问题) 如何实现图片放大后逐渐清晰 【史上最给力】哈工大WI输入法现在发布啦!!!!!!!!!!!!!!! 安装新版本后请重启。之前安装过公测版的用户请务必先卸载后再安装。
{
// Since this will be launched in a separate thread, we need
// an autorelease pool
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
[NSURL URLWithString:@"http://TWITTER_ACCOUNT:[email protected]/statuses/update.xml"]
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0];
// The text to post
NSString *msg = @"testing";
// Set the HTTP request method
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg]
dataUsingEncoding:NSASCIIStringEncoding]];
NSURLResponse *response;
NSError *error;
if ([NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:&error] != nil)
NSLog(@"Posted to Twitter successfully.");
else
NSLog(@"Error posting to Twitter.");
// Release pool
[pool release];
}