新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > iOS開發(fā)常用的第三方類庫

iOS開發(fā)常用的第三方類庫

作者: 時間:2016-10-08 來源:網(wǎng)絡 收藏
3
4
5
6
7
8
9
10
11
12
13
NSURL *url = [NSURL URLWithString:@ http://allseeing-i.com ];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setCompletionBlock:^{
// Use when fetching text data
NSString *responseString = [request responseString];
// Use when fetching binary data
NSData *responseData = [request responseData];
}];
[request setFailedBlock:^{
NSError *error = [request error];
}];
[request startAsynchronous];

它的ASIFormDataRequest子類可以橫容易的提交表單數(shù)據(jù)和文件:

本文引用地址:http://2s4d.com/article/201610/305920.htm
1
2
3
4
5
6
7
8
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@Ben forKey:@first_name];
[request setPostValue:@Copsey forKey:@last_name];
// Upload a file on disk
[request setFile:@/Users/ben/Desktop/ben.jpg withFileName:@myphoto.jpg andContentType:@image/jpeg
forKey:@photo];
// Upload an NSData instance
[request setData:imageData withFileName:@myphoto.jpg andContentType:@image/jpeg forKey:@photo];



關鍵詞:

評論


相關推薦

技術專區(qū)

關閉