Good day,
I just signed up to the mailing list, though I have been a very happy user of
Cordova for a while now. I am working on a plugin for Cordova, and have thus
far developed on iOS, and everything is fine. I started a new project with
Cordova OS X, and ported some code over. But it was not working right. Took a
long while to figure out what was happening. The iOS version has support for
passing ArrayBuffer objects from the JS to native side (as NSData). This is a
_very_ useful feature. So I had assumed it would work with the OS X version. I
was wrong of course.
I tracked it down to this code in CDVBridge.m:
- (NSArray WebScriptObject*)webScriptObject
{
// Assumption: webScriptObject has already been tested using isArray:
NSUInteger count = [[webScriptObject valueForKey:@"length"] integerValue];
NSMutableArray *a = [NSMutableArray array];
for (unsigned i = 0; i < count; i++) {
id item = [webScriptObject webScriptValueAtIndex:i];
if ([item isKindOfClass:[WebScriptObject class]]) {
if ([self isArray:item]) {
[a addObject:[self convertWebScriptObjectToNSArray:item]];
} else if ([self isDictionary:item]) {
[a addObject:[self convertWebScriptObjectToNSDictionary:item]];
};
} else {
[a addObject:item];
}
}
return a;
}
The ArrayBuffer object isKindOfClass WebScriptObject, but it is neither an
Array or a Dictionary, so it gets dropped here.
Any chance on a patch to make this work? I am a programmer, but not familiar
enough with the Cordova internals and/or the WebScript area to know the proper
check and conversion to put here.
Thank you,
Tyler