UIWebView에서 자바스크립트에 파라미터를 넘기려면 함수 호출의 형태로 해야 한다.
출처 : http://lists.apple.com/archives/Cocoa-dev/2009/Jan/msg02482.html
자바스크립트 변수 window.wallet.storedData에 "aaa"값을 넣을때
잘못된 방법
[webView stringByEvaluationJavaScriptFromString:[NSString stringWithFormat:@"window.wallet.storedData='%@';", @"aaa"]];
옳은 방법
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"(function() {window.wallet.storedData = '%@';}) ()", @"aaa"]];
'iOS > 참고' 카테고리의 다른 글
[펌] Back to the Mac 선정 - 올해의 추천 맥용 프로그램 100선 (0) | 2013.05.20 |
---|---|
iOS 크래시(.crash) 로그 파일 분석하기 (0) | 2013.05.13 |
UIWebView 자바스크립트에 파라미터 넘기는 방법 (0) | 2013.03.23 |
UIView -> UIImage (0) | 2013.02.19 |
[발번] Core Data Model Versioning and Data Migration - Introduction (0) | 2012.12.28 |
XCode 테마 설정 (0) | 2012.11.19 |
댓글을 달아 주세요