I'm trying to build a module that uses CoreBluetooth. I already have existing code that wraps all of the CoreBluetooth for the TI CC2540 key fob peripheral that I'm writing this module for that works on the device when run from Xcode. Where do I put this 3rd-party code (.h, .m files) so that I don't get the error OBJC_CLASS$_<MyClass>
Basically I have a .h, .m files defining and implementing class MyClass. I'm trying to, in my Com<ModName>Module.h and .m files, create an instance of MyClass. I've placed the 3rd-party .h file in my Classes folder, and I've been able to change the label to a value defined in a different file, but for some reason I can't instantiate.
I've watched the videos and read the iOS module development guides, but I've not found any examples of using external code. Yes, I know how to install modules, and I can pull defined constants from an external .h file, but I am unable to instantiate an object.
In my Com<ModName>Module.h I have
#import "TiModule.h" #import "MyClass.h" @interface ComModNameModule : TiModule { @protected MyClass * myObj; } @endthe MyClass.m file goes ahead and implements all of the functions associated with the MyClass.h
In the Com<ModName>Module.m I have
-(void)startup { // this method is called when the module is first loaded // you *must* call the superclass [super startup]; myObj = [[MyClass alloc] init]; [myObj controlSetup:1]; NSLog(@"[INFO] %@ loaded",self); }I'm also including the MyClass.h in the Com<ModName>Module.m.
Can anyone tell me what I'm doing wrong? Or at least even point me to an example of another module including code from another 3rd-party code file? I look through the examples on the titanium github account, but none of the documentation is complete, nor were they using external classes.
2 Answers
Accepted Answer
Hi Kelly, Place the third party libraries in the xcode project just by drag and drop.Select copy option when asked.
The 3rd party libraries weren't even compiling because I hadn't added them into my Xcode project. They were in the same Classes folder as the module files, but nothing was telling the Xcode project to include them. Add these to your project IN Xcode, and this will work out for you.
Your Answer
Think you can help? Login to answer this question!