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

iOS應(yīng)用程序 Twitter開發(fā)代碼

移動開發(fā) iOS
本文介紹的是iOS應(yīng)用程序 Twitter開發(fā)代碼,主要介紹了Twitter其中的代碼與大家分享,不如先來看內(nèi)容。

iOS應(yīng)用程序 Twitter開發(fā)代碼是本文要介紹的內(nèi)容,先來了解一下Twitter,它是國外的一個社交網(wǎng)絡(luò)及微博客服務(wù)的網(wǎng)站。它利用無線網(wǎng)絡(luò),有線網(wǎng)絡(luò),通信技術(shù),進行即時通訊,是微博客的典型應(yīng)用。

Twitter允許用戶將自己的***動態(tài)和想法以短信形式發(fā)送給手機和個性化網(wǎng)站群,而不僅僅是發(fā)送給個人。2006年,博客技術(shù)先驅(qū)blogger.com創(chuàng)始人埃文·威廉姆斯(Evan Williams)創(chuàng)建的新興公司Obvious推出了大圍脖服務(wù)。在最初階段,這項服務(wù)只是用于向好友的手機發(fā)送文本信息。2006年底,Obvious對服務(wù)進行了升級,用戶無需輸入自己的手機號碼,而可以通過即時信息服務(wù)和個性化Twitter網(wǎng)站接收和發(fā)送信息。

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

代碼地址:http://blog.csdn.net/cloudhsu/article/details/6048626

 

  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. [NSThread detachNewThreadSelector:@selector(postToTwitter)  
  33.    toTarget:self withObject:nil];  
  34. - (void) postToTwitter  
  35. {  
  36.   // Since this will be launched in a separate thread, we need  
  37.   // an autorelease pool  
  38.   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
  39.   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:  
  40.     [NSURL URLWithString:@"http://TWITTER_ACCOUNT:PASSWORD@twitter.com/statuses/update.xml"]   
  41.     cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0];  
  42.   // The text to post  
  43.   NSString *msg = @"testing";  
  44.    
  45.   // Set the HTTP request method  
  46.   [request setHTTPMethod:@"POST"];  
  47.    
  48.   [request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg]   
  49.     dataUsingEncoding:NSASCIIStringEncoding]];  
  50.    
  51.   NSURLResponse *response;  
  52.   NSError *error;  
  53.    
  54.   if ([NSURLConnection sendSynchronousRequest:request   
  55.       returningResponse:&response error:&error] != nil)  
  56.     NSLog(@"Posted to Twitter successfully.");  
  57.   else   
  58.     NSLog(@"Error posting to Twitter.");   
  59.    
  60.   // Release pool  
  61.   [pool release];   
  62. }   
  1. [NSThread detachNewThreadSelector:@selector(postToTwitter)  
  2.    toTarget:self withObject:nil]; 

小結(jié):iOS應(yīng)用程序 Twitter開發(fā)代碼的內(nèi)容介紹完了,希望本文對你有所幫助。

本文來自:http://www.cocoachina.com/iphonedev/sdk/2010/1202/2431.html

責(zé)任編輯:zhaolei 來源: CocoaChina
相關(guān)推薦

2011-08-11 16:50:04

iOSTwitter

2011-08-08 13:26:48

iOS開發(fā) Twitter

2009-07-07 00:01:32

Twitter應(yīng)用

2013-01-11 15:06:13

iOS開發(fā)移動應(yīng)用iPhone

2011-07-18 10:21:04

iOS Visual Stu iphone

2013-01-11 15:24:02

iOS開發(fā)移動應(yīng)用iPhone

2013-01-11 14:45:43

iOS開發(fā)移動應(yīng)用iPhone

2012-03-15 15:35:51

iUI框架EclipseiOS Web

2022-08-02 16:33:54

網(wǎng)絡(luò)安全密鑰數(shù)據(jù)泄漏

2012-02-08 15:06:31

ibmdw

2022-09-19 00:37:13

SaaS云計算開發(fā)

2013-02-21 14:14:40

開發(fā)Tizen

2013-02-21 14:15:41

開發(fā)Tizen

2011-07-18 10:00:47

iPhone iOS Visual Stu

2013-01-11 14:33:14

iOS開發(fā)移動應(yīng)用iPhone

2020-02-20 12:50:47

后端代碼應(yīng)用程序

2013-11-19 15:35:01

2009-09-24 17:21:17

加速Hibernate

2009-07-17 16:09:29

Swing桌面應(yīng)用程序

2011-05-31 13:34:22

應(yīng)用開發(fā)iPad
點贊
收藏

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