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());?> |
Conversation
In the margins
0 notes
No comments yet. Be the first to leave a note.