← 전체 글
iOS

WebView 호출 POST 방식으로..

GET 방식 호출은 http://URL?arg=xxx&arg1=yyy 요런식으로 호출 POST 방식은 NSURL *url = [NSURL URLWithString: @http://URL]; NSString *body = [NSString stringWithFormat: @"arg1=%@&arg2=%@", @"val1",@"val2"]; NSMutableURLRequest *request = [[NSMutableURLReq…

GET 방식 호출은 http://URL?arg=xxx&arg1=yyy 요런식으로 호출

POST 방식은

NSURL *url = [NSURL URLWithString: @http://URL];

NSString *body = [NSString stringWithFormat: @"arg1=%@&arg2=%@", @"val1",@"val2"];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];

[request setHTTPMethod: @"POST"];

[request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];

[webView loadRequest: request];

요런식으로 호출하면 값 잘 넘어갑니다.

© 2026 Maandoo