: 당신의 PHP 스크립트에 의해 제공
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-type"];
NSString *xmlString = [NSString stringWithFormat:@"%@"];
[request setValue:[NSString stringWithFormat:@"%d", [xmlString length]]
forHTTPHeaderField:@"Content-length"];
[request setHTTPBody:[xmlString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
응답이 모두 구현해야합니다 (대표 검색 할 수 있습니다 자세한 내용은 있는 NSURLConnection 설명서를 참조가,이 인 예 :
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)response
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
이것은 텍스트 파일에서만 작동하는 것처럼 보입니다. ZIP 아카이브와 같은 파일은 어떻게됩니까? –
setHTTPBody는 NSData 객체를 허용합니다 (http://stackoverflow.com/questions/3891149/convert-zip-file-into-nsdata 참조). –