Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

-parentFrame is a private API #2

Copy link
Copy link

Description

@ItalyPaleAle
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.