drnicwilliams.com
10 May '12, 12am
@drnic you're post on using webkit in obj-c projects for iOS is still the most comprehensive documentation I've found:
We’ve done a fair amount of webkit embedding as well, and your comments are spot on. One additional item of note is logging from javascript – one would think console.log would send to the same place as NSLog from objective-c when running within embedded webkit (and normal console.log otherwise). This is not the case. I’ve submitted a bug into the abyss that is Apple’s bug reporting system. So we implemented our own logger that we inject into whatever document we load within webkit. We tried using the callback mechanism by setting document.location to a custom url, and this worked at first but would cause weird behavior depending on where/when it was called, and so we ended up settling on a polling mechanism. From a class extending UIWebView: - (id)initWithCoder:(NSCoder *)coder { if (self = [super initWithCoder:coder]) { self.delegate = self; #ifdef DEBUG [self createJavas...
Full article:
http://drnicwilliams.com/2008/11/10/to-webkit-or-not-to-w...