嗨,我正在为 NSURLConnection 使用以下代码
//initialize new mutable data
responseData = [[NSMutableData alloc] init];
//initialize url that is going to be fetched.
NSURL *url = [NSURL URLWithString:URLCALL];
//initialize a request from url
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[url standardizedURL]];
//set http method
[request setHTTPMethod:@"POST"];
//initialize a post data
NSString *postData = [[NSString alloc] initWithString:@"action=3&senderCountryCode=91&senderPhoneNo=9573795715& receiverPhoneNo=9336240585&version=1.0"];
//set request content type we MUST set this value.
[request setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
//set post data of request
[request setHTTPBody:[postData dataUsingEncoding:NSUTF8StringEncoding]];
//initialize a connection from request
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
//start the connection
[connection start];
现在我必须将文件添加为多部分类型请帮助我如何使用它