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

iPhone開發(fā)應(yīng)用ASIHTTPRequest如何獲取文件流

移動開發(fā) iOS
iPhone開發(fā)應(yīng)用ASIHTTPRequest如何獲取文件流是本文要介紹的內(nèi)容,主要講解的是如何獲取文件流,來看本文詳細(xì)代碼實現(xiàn)。

iPhone開發(fā)應(yīng)用ASIHTTPRequest如何獲取文件流是本文要介紹的內(nèi)容,主要講解的是如何獲取文件流,內(nèi)容不多,主要是基于代碼來實現(xiàn)文件流的獲取,不多說,來看詳細(xì)代碼。在服務(wù)器上獲取文件中的內(nèi)容,此例中的文件為TXT文件

  1. - (void)getContact{  
  2. NSString *host = [[NSUserDefaults standardUserDefaults]objectForKey:@"HOST"];  
  3. ASIHTTPRequest *m_request = [[ASIHTTPRequest alloc]initWithURL:  
  4.    [NSURL URLWithString:[NSStringstringWithFormat:@"%@:8090/contact.txt",host]]];  
  5. [m_request setDelegate:self];  
  6. [m_request setDidFailSelector:@selector(ASIHttpRequestFailed:)];  
  7. [m_request setDidFinishSelector:@selector(ASIHttpRequestSuceed:)];  
  8. [m_request startAsynchronous];  
  9. }  
  10.  
  11. - (void)ASIHttpRequestFailed:(ASIHTTPRequest *)m_request{  
  12. [self hideDial];  
  13. if (m_request) {  
  14. [m_request release];  
  15. }  
  16. }  
  17.  
  18. - (void)ASIHttpRequestSuceed:(ASIHTTPRequest *)m_request{  
  19. NSData *data = [m_request responseData];  
  20.  
  21. if (data)   
  22. {  
  23. NSString *string = [[NSString alloc] initWithData:dataencoding:NSUTF8StringEncoding];  
  24. NSLog(@"%@",string);  
  25. [contact clean];  
  26. if (string)   
  27. {  
  28. [contact storeContacts:string Source:1];  
  29. }  
  30. [string release];  
  31. }  
  32. if (m_request) {  
  33. [m_request release];  
  34. }

小結(jié):關(guān)于iPhone開發(fā)應(yīng)用ASIHTTPRequest如何獲取文件流的內(nèi)容介紹完了,希望本文對你有所幫助!

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

2011-08-10 17:37:00

iPhoneASIHTTPRequ

2011-08-11 13:35:28

iPhoneASIHTTPRequHTTP

2011-08-19 14:34:03

iPhone開發(fā)

2011-08-12 14:33:06

iPhone緩存文件

2013-07-22 14:10:26

iOS開發(fā)ASIHTTPRequ

2013-07-22 14:38:00

iOS開發(fā)ASIHTTPRequ

2013-07-21 18:22:59

iOS開發(fā)ASIHTTPRequ

2013-07-21 18:18:00

iOS開發(fā)ASIHttpRequ

2013-07-21 18:27:15

iOS開發(fā)ASIHTTPRequ

2011-07-19 09:46:38

2011-07-08 14:58:16

iPhone Xcode iOS

2011-07-19 09:58:36

2011-08-08 16:56:44

iPhone 字符處理 視圖

2011-08-08 10:10:14

iPhone開發(fā) 圖片 方法

2011-08-09 17:29:29

iPhone文件屏幕

2011-08-10 10:10:21

iPhoneUIPopoverCo

2011-08-03 17:44:57

iPhone App 文件

2011-08-17 15:10:21

iPhone開發(fā)Web視圖

2013-07-22 14:15:17

iOS開發(fā)ASIHTTPRequ

2013-07-22 14:33:15

iOS開發(fā)ASIHTTPRequ
點贊
收藏

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