NativeScript / plugin-seed

Build NativeScript Plugins Fast ⚡
https://docs.nativescript.org/plugins/plugin-workspace-guide
Apache License 2.0
45 stars 11 forks source link

NSObject subclasses not instantiating correctly (iOS) #7

Closed JWiseCoder closed 3 years ago

JWiseCoder commented 4 years ago

I'm trying to bring over my plugins to this new plugin workspace, and I've got everything in and working EXCEPT for the any subclasses I have that inherit from NSObject. Objects instantiated from these classes are to be used as delegates—one for MKMapViewDelegate, the other for CLLocationManagerDelegate. I've tried creating objects with the .new() static function and by using the new ClassName() syntax. In the first case(.new()), I just get back an NSObject that does not have any of my properties or methods in it. In the second case, I get the correct object, but delegate methods never get called.

All this was working in my other plugin project where I built this plugin. (There, I'm using .new() to create the objects)

I thought this might have to do with the new @NativeClass() decorator, so I added it to my files. The plugin builds fine, but when I run the demo, I get "ReferenceError: NativeClass is not defined." I've tried fixing it according to the NS 7 update instructions (https://nativescript.org/blog/nativescript-7-for-plugin-authors/), but nothing seems to work.

Is there something I might be missing that would be different between the old plugin seed and this one? Why would I suddenly be getting blank NSObjects when I call .new()?

JWiseCoder commented 4 years ago

I started again with a clean workspace and brought over everything, and it seems to work now. I'm still testing it out because it looks like there may be some other issue.

NathanWalker commented 3 years ago

@JWiseCoder thanks for confirming - feel free to reopen if something else comes up.