Use JSB reflection in Cocos Creator 2.1

Use JSB reflection in Cocos Creator 2.1
0

#1

I see an article talking about the JSB reflection API here: http://docs.cocos2d-x.org/creator/manual/en/advanced-topics/oc-reflection.html

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!


#2

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.


#3

Very good. Thank you!