How can my iPhone Objective-C code get notified of Javascript errors in a UIWebView?

后端 未结 10 2446
再見小時候
再見小時候 2020-11-29 16:31

I need to have my iPhone Objective-C code catch Javascript errors in a UIWebView. That includes uncaught exceptions, syntax errors when loading files, undefined variable re

10条回答
  •  难免孤独
    2020-11-29 16:53

    See exception handling in iOS7: http://www.bignerdranch.com/blog/javascriptcore-example/

    [context setExceptionHandler:^(JSContext *context, JSValue *value) {
        NSLog(@"%@", value);
    }];
    

提交回复
热议问题