如何发送信息到Twitter上面

  • Post author:
  • Post category:其他


//TWITTER BLACK MAGIC
NSMutableURLRequest *theRequest =[NSMutableURLRequest  
                  requestWithURL:[NSURL URLWithString :
                  @"http://YOUR_TWITTER_UESERNAME:YOUR_TWITTER_PASSWORD@twitter.com/statuses/update.xml"] 
                  cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; 

[theRequest setHTTPMethod:@"POST"];

[theRequest setHTTPBody:[[NSString stringWithFormat:@"status=%@",theMessage]
dataUseEncoding:NSASCIIStringEncoding]];

NSURLResponse* response;

NSError*error;

NSData result = [NSURLConnection sendSynchronousRequest:theRequest
returningResponse:&response error:&error];

NSLog(@"%@",[[[NSString alloc]initWithData:result
encoding:NSASCIIStringEncoding]autorelease]);

//END TWITTER BLACK MAGIC




版权声明:本文为WHY_IOS原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。