自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iOS開發(fā)應(yīng)用里Twitter使用

移動(dòng)開發(fā) iOS
本文介紹的是iOS開發(fā)應(yīng)用里Twitter使用方法,很詳細(xì)的介紹了Twitter方法的使用,先來(lái)看內(nèi)容詳解。

iOS開發(fā)應(yīng)用里Twitter使用是本文要介紹的內(nèi)容,Twitter現(xiàn)在歐美地區(qū)極其火爆,如果各位開發(fā)者想在應(yīng)用中增加 Twitter 功能,可以看一下許靖昕先生在博客中分享的代碼。

  1. - (void) postToTwitter  
  2. {  
  3.   // Since this will be launched in a separate thread, we need  
  4.   // an autorelease pool  
  5.   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
  6.    
  7.   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:  
  8.     [NSURL URLWithString:@"http://TWITTER_ACCOUNT:PASSWORD@twitter.com/statuses/update.xml"]   
  9.     cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0];  
  10.    
  11.   // The text to post  
  12.   NSString *msg = @"testing";  
  13.    
  14.   // Set the HTTP request method  
  15.   [request setHTTPMethod:@"POST"];  
  16.    
  17.   [request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg]   
  18.     dataUsingEncoding:NSASCIIStringEncoding]];  
  19.    
  20.   NSURLResponse *response;  
  21.   NSError *error;  
  22.    
  23.   if ([NSURLConnection sendSynchronousRequest:request   
  24.       returningResponse:&response error:&error] != nil)  
  25.     NSLog(@"Posted to Twitter successfully.");  
  26.   else   
  27.     NSLog(@"Error posting to Twitter.");   
  28.    
  29.   // Release pool  
  30.   [pool release];   
  31. }    
  32.  
  33. [NSThread detachNewThreadSelector:@selector(postToTwitter)  
  34.    toTarget:self withObject:nil]; 

小結(jié):iOS開發(fā)應(yīng)用里Twitter使用的內(nèi)容介紹完了,希望通過本文對(duì)你有所幫助!

責(zé)任編輯:zhaolei 來(lái)源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-08-11 16:50:04

iOSTwitter

2011-07-21 16:19:30

iOS Twitter

2014-06-13 11:06:36

RoboVMiOS應(yīng)用

2012-01-18 13:46:37

ARCiOS

2021-01-26 19:13:15

iOS開發(fā)文本編輯器Twitter

2012-02-13 14:22:22

MonoTouchiOS應(yīng)用Visual Stud

2011-05-11 10:02:37

iOS

2011-07-18 10:21:04

iOS Visual Stu iphone

2013-09-13 13:16:05

2011-07-08 14:58:16

iPhone Xcode iOS

2012-05-21 21:34:51

iOS

2012-02-13 14:10:11

MonoTouchiOS應(yīng)用Visual Stud

2011-07-18 10:00:47

iPhone iOS Visual Stu

2011-08-19 17:44:01

2011-08-17 14:30:34

iOS開發(fā)窗口

2012-02-02 10:14:14

2011-07-26 11:08:23

iOS 錄像 錄音

2011-08-17 14:20:21

IOS開發(fā)GraphicsCon

2012-01-18 10:57:37

ARCiOS

2012-02-13 13:45:04

MonoTouch.NETiOS應(yīng)用
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)