[Xcode] change I-OS Webview header

HYEONG HWAN, MUN/ 10월 18, 2014/ 미분류/ 0 comments

https://blog.lael.be/post/195

Xcode 에서 기본객체인 Webview URL 요청시 헤더를 수정하는 방법입니다.

저는 간단하게 UDID와 Geolocation X, Y 좌표만 넘겨받습니다.

여러가지 해봤는데 되는 방법입니다.
무난 한 방법

1
2
3
4
5
6
7
NSString *urlString = [NSString stringWithFormat:@"https://lael.be"];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSString *udid = [[UIDevice currentDevice]uniqueIdentifier];
[request setValue:udid forHTTPHeaderField:@"UDID"];
[myWebView loadReuqest:request];

실제로 다음코드로 찍어보면 헤더에 UDID값이 포함되어 있음을 알 수 있습니다.

1
2
3
<?
print_r(apache_request_headers());
?>

 

Leave a Comment

작성하신 댓글은 관리자의 수동 승인 후 게시됩니다.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*