1
votes

Since there is no easy way to add multi image selection in Appcelerator, I'd like to incorporate this project: WSAssetPickerController - https://github.com/w5mith/WSAssetPickerController into my Appcelerator project.

I'm able to create a simple custom module in XCode/ObjC, and call it from Appcelerator, but I'm not sure how to call code that has a UI such as WSAssetPickerController does. Any tips would be appreciated.

Here is some code I have working now. This is pretty much boiler plate Appcelerator Custom Module stuff contained in an ObjC implementation class: https://gist.github.com/3976969

Then in my Appclerator project, I load this module like this:

// in app.js
var myModule = require('com.example.test');
Ti.API.info("--->module loaded is ---> "+myModule);

// in testing.js
function createFoo() {          
   myModule.sayHello();             
}

So, with this in place I am able to create a custom module in ObjC, load it up into Appcelerator and call a method on it.

I now want to the open source module WSAssetPickerController - however, this is quite a bit more sophisticated than my sayHello() method, as it contain a user interface view that needs to be loaded and displayed from Appcelerator. The documentation says to include all the code from the "src" directory (which I have done) into my ObjC project, then use code like this to load it:

WSAssetPickerController *controller = [[WSAssetPickerController alloc] initWithDelegate:self];
[self presentViewController:controller animated:YES completion:NULL];

But, this not working for me. Within XCode, I get a compiler warning on the first line of: "Sending 'ComExampleTestModule *' to parameter of incompatiple type 'id

UPDATE: after some changes here is what I have now: I modified the @interface line in ComExampleTestModule.h to:

@interface ComExampleTestModule : TiModule <WSAssetPickerControllerDelegate> 

and I added this import statement:

#import "WSAssetPicker/WSAssetPicker.h"

but I am still getting compiler warnings in my .m file like this: "Instance method '-dismissViewControllerAnimated:completion' not found (return type defaults to 'id'.......

Thanks for the help.

1
look at the example I provided below on how to open the controller - Aaron Saunders
Thanks, but I'm still having an issue. I added this line to .h file: see edit above in question - Jim Jones

1 Answers

0
votes

what have you got written so far? Can you post it somewhere??

also take a look at some code I have in my repo... it might get you started

http://blog.clearlyinnovative.com/post/27531529814/titanium-appcelerator-quickie-cardio-integration