Open
Description
My app got rejected by the static analyzer for using this method because -parentFrame is a private API.
I managed to solve that by checking on the delegate if the jsContext that's passed is the same as the context for the main frame:
- (void)didCreateJavaScriptContext:(JSContext *)jsContext
{
// Get the context for the main frame and verify it's the same
JSContext *mainFrameCtx = [self valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
if(jsContext == mainFrameCtx) {
// Call the delegate
if(self.delegate && [self.delegate respondsToSelector: @selector(webView:didCreateJavaScriptContext:)] ) {
[(id<TSWebViewDelegate>)self.delegate webView:self didCreateJavaScriptContext:jsContext];
}
}
else {
NSLog(@"JavaScript contexts are different");
}
}
By using the delegate method, we're still sure that the JSContext object is created when we ask for it.
Metadata
Metadata
Assignees
Labels
No labels