How to call method from (Ads integration)

How to call method from (Ads integration)
0.0 0


Hi everyone!
I added RevMob ads to my Android game today and now I am adding it to iOS version (this tutorial:
It works well but I want to manually tell when to show/hide ads.
What I did was added method showAds() to CCApplication.cpp and classes.
I managed it on Android, but I don’t know how to do it on iOS.
My RevMob banner is in class:

+ (void)show {
    [RevMobAds startSessionWithAppID:@"ads id"];
    [RevMobAds session].testingMode = RevMobAdsTestingModeWithAds;
    [[RevMobAds session] showBanner];

and I have following method in

void CCApplication::showAds(bool pszUrl)
    //here i wanna to execute show() method

I don’t know ObjectiveC but I suppose it is very easy to do :slight_smile:
In Java I did it with abstract method added to and implemented in

How can I execute show() method from
Or is there any other solution to show/hide RevMob banner on iOS platform game?
Thanks in advance!
Best regards!


you should be able to call
Directly from your c++ code


Thank you very much for your reply.
I don’t need to call showAds() from but I need to call AppController’s (void)show method from


Did you guys manage to show/hide AdMob on iOS?


Did you find the solution yet? I’m having the same trouble.



Hi, I used NSNotification center:



Hi sortris,

Thanks for the quick reply. I will follow the links.

Best regards,


Easiest way is:

[AppController show];

That works because your show method is static (the + indicate a static method in Objective-C).
For non-static methods, you need to acquire an instance of the object. The easiest way to do that is to use a singleton, for example:

[[AppController sharedController] show];

Please note: to do that, your file needs to be a .mm (.m or .cpp won’t work), and it’s iOS specific, so it’s best if you put the file in an iOS specific location.
The prefered way to do wrappers (because that’s what it is) is to have the .h shared between all platforms, and a .cpp (Android) or .mm (iOS) specific to the platform, which implements the .h methods.