Cordova를 이용해 개발 중 Web에 console.log() 의 경우 Android에서는 디버그로 볼 수 있지만 iOS 에서 보이지 않는 현상이 발생
하기와 같이 코드를 추가해 주면 xcode console에서 해당 로그를 볼 수 있음
#import <JavaScriptCore/JavaScriptCore.h>
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
NSLog(@"Finished load of: %@", theWebView.request.URL);
JSContext *ctx = [theWebView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
ctx[@"console"][@"log"] = ^(JSValue * msg) {
NSLog(@"JavaScript %@", msg);
};
}
'Mobile > iOS' 카테고리의 다른 글
[iOS] The app delegate must implement the window property if it wants to use a main storyboard file. 오류 관련 (0) | 2020.10.28 |
---|---|
[iOS] Guideline 2.3.3 - Performance - Accurate Metadata (0) | 2019.01.12 |
[iOS] javascript click event 오류 (0) | 2019.01.11 |
[iOS] iTunse Connect 앱 미리보기 및 스크린샷 사이즈 (0) | 2019.01.11 |
[iOS] 프로그램 역할 및 App Store Connect 역할 (0) | 2019.01.08 |