Thursday, September 11, 2014
Wednesday, July 2, 2014
Friday, June 27, 2014
How to redirect JavaScript console.log() to Xcode's debug output
On iOS >= 7.0 it is pretty easy thanks to brilliant (and undocumented as well) framework:
@import JavaScriptCore;
...
// get UIWebView's JavaScript context
JSContext *ctx = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
// 'listen' to console.log()
ctx[@"console"][@"log"] = ^(NSString *message) {
NSLog(@"Javascript's console.log() :\n%@\n\n", message);
};
Friday, June 13, 2014
Monday, May 5, 2014
Friday, March 28, 2014
Subscribe to:
Comments (Atom)