I'm using JavascriptCore in my app. Now, I'm passing some variables to the JSContext that can then be passed back to Objective-C. However, one of the variables, an NSDictionary, is not passing through correctly. I run the code below:
var evaluate = function(variables) {
app.setDictionary(variables.dictionary);
}
This is a simple example that has these following methods set up in JSContext.
This is the setDictionary() method:
- (void)setDicationary:(NSDictionary *)dictionary {
self.mutableDictionary = [dictionary mutableCopy];
}
This is variables.dictionary:
- (NSDictionary *)dictionary {
return self.values;
}
And this is how I call evaluate():
JSValue *jsFunction = self.context[@"evaluate"];
JSValue *value = [jsFunction callWithArguments:@[self.variables]];
However, in the setDictionary method, I don't get an NSDictionary, but instead get a NSString containing [object Object].
Any ideas how I can solve this?