Question

Hey Guys I need some help please. I have integrated IAP into my app, and every IAP is working great except when it comes to disabling Revmob ads. Has anyone ever done this? I am using Full Screen and pop up. But I have no clue how to stop the ads once the purchase is successful. Any help will be greatly appreciated.

Was it helpful?

Solution

If your the IAP is non-consumable the easiest way would be to add a flag to NSUserDefaults that becomes enabled once a user has bought the IAP. Then before you call the ad check if the flag is enabled or not.

Some sudo code for this would be:

// in whatever class handles your IAP
-(void)userBoughtOrRestoredTheNoAdsIAP {
    [defaults setBOOL:YES forKey:HideAdsForUser];
}

// in your view controller
-(void)displayAd {
    if (![defaults boolForKey:HideAdsForUser]) {
        [RevMobAd showFullscreen];
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top