Search code examples
objective-ccocoacocos2d-xapplovin

Integrate Applovin to Cocos2d-x iOS app


I want to integrate Applovin SDK to my Cocos2d-x iOS app, but the delegate doesn't work.

[ALInterstitialAd shared].adDisplayDelegate = self;  << Error: Use of undeclared identifier 'self'
[ALInterstitialAd showOver:[[UIApplication sharedApplication] keyWindow]];

OR

objClass *obj1 = [objClass alloc];
[ALInterstitialAd shared].adDisplayDelegate = obj1;  << Error: assigning 'id<ALAdDisplayDelegate>' from incompatibile type "objClass *"

OR

init: objClass* obj1 = [[objClass alloc] init];
[ALInterstitialAd shared].adDisplayDelegate = obj1;  << Error: assigning 'id<ALAdDisplayDelegate>' from incompatibile type "objClass *"

How to fix this? I want to capture those listener events.


Solution

  • I've just resolved this issue, but I'm working with pure Object-C in Xcode. I was getting error until I added delegate methods: ALAdDisplayDelegate, ALAdLoadDelegate, ALAdUpdateObserver, ALAdVideoPlaybackDelegate

    .h

    #import "ALInterstitialAd.h"
    
    @interface VSGalleryViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate, ALAdDisplayDelegate, ALAdLoadDelegate, ALAdUpdateObserver, ALAdVideoPlaybackDelegate>
    

    Hope it helps