Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17076

[SOLVED] JSB Reflection - get string from Objective-C

$
0
0

@AndreyFomin wrote:

Hi,

How to send a string from Objective-C to JavaScript by JSB Reflection?

I need to get Advertiser ID from Objective-C to my JavaScript Cocos2d-JS 3.8. Trying this:

function getAID() {
return jsb.reflection.callStaticMethod("RootViewController", "getAID");
}

And in RootViewController.mm:

+(const char *)getAID
{
ASIdentifierManager *adMgr = [ASIdentifierManager sharedManager];
NSString *appleAdId = [[adMgr advertisingIdentifier] UUIDString];
const char *sss([appleAdId UTF8String]);
return sss;
}

But get error in XCode: not support return type = r *

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>