Use JSB reflection in Cocos Creator 2.1

Use JSB reflection in Cocos Creator 2.1


I see an article talking about the JSB reflection API here:

But it doesn’t tell me how to import the jsb module. In Visual Studio Code it’s not auto-completing the jsb module so I’m assuming there’s an extra step required to get it to auto-complete.

Is there an additional step to make the jsb module visible?
Are there any projects that show how to use reflection for iOS and Android?
Maybe the module is there, but since it communicates with a native library, it’s not something that auto-completes but Just Works when built for the respective native platform?

Any help is appreciated. Thank you!


jsb.reflection.callStaticMethod not appear in creator.d.ts,you can build IOS(Android) project,and search jsb.reflection.callStaticMethod,you would find the way of use.


Very good. Thank you!