Yes, I thought it would have handled it too, since I had seen that exec code in 
the cordova.js file. But it appears the OS X version uses a different method to 
get the JS objects into the native side. Odd, since I would expect that code to 
be identical in both iOS and OS X.

I will see if I can add a feature request. Have not used the tracking system 
yet, so we shall see…

Thanks,
Tyler

On Jul 4, 2013, at 2:05 AM, Shazron <[email protected]> wrote:

> You should add a feature request - surprised it didn't get "converted"
> using our mechanism here though:
> https://github.com/apache/cordova-js/blob/master/lib/osx/exec.js#L70
> 
> 
> 
> On Mon, Jul 1, 2013 at 4:20 PM, Tyler Wilson 
> <[email protected]>wrote:
> 
>> 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

Reply via email to