JSContext Release

时间:2017-04-10 06:17:43

标签: ios objective-c javascriptcore

这是我的代码:

JSContext *context = [_webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];

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

JSObject *obj = [[JSObject alloc] init];
context[@"iOS"] = obj;

上述JSObject未发布。你有什么办法吗?

1 个答案:

答案 0 :(得分:-2)

JSObject * obj = [[[JSObject alloc] init] autorelease];