Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

pass blob into iOS module

$
0
0

I need to pass in a blob to a module in iOS, but once inside the module there doesn't appear to be a way to cast the argument as a TiBlob. Here is a cutdown version of my js test-case source:

var inFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, filename);
var blob = inFile.read()
myModule.sendData(blob);
and this is the relevant function in the iOS Module:
-(id)sendData:(id)args
{
    if ([args isMemberOfClass:[TiBlob class]]) {
        NSLog(@"[INFO] It's a blob! %@ ",[args length]);
    } else {
        NSLog(@"[INFO] Dunno what it is luv ");
    }
 
   return @"some text";
}
The log reports "Dunno what it is luv". I know that args come through to the iOS module as an NSArray*, but there are no helper functions in TiUtils.h that allow me to cast it to a TiBlob so I can actually access the bytes.

(I do actually use the same file both in the module and in the appcelerator JS, hence wanting to pass a blob - which I assume is a reference - rather than have the file in memory twice).


Viewing all articles
Browse latest Browse all 8068

Trending Articles