As you already know, you should check your purchase status before showing ads.
Itβs a good idea to save status somewhere in the document directory. (NSUserDefaults provides this feature for storing information in key-value pairs).
Here is a sample code, it can be useful to everyone who is trying to do this.
You can configure it to call upon a successful purchase.
NSUserDefaults * defaults; [defaults setObject:@"Purchased" forKey:@"InAppStatus"];
and before deciding to show ads, you can check the status.
if([[defaults valueForKey:@"InAppStatus"] isEqualToString:@"Purchased"]) { //App Should Unlock with No Ads } else { //Show Ads }
Apple simply provides a way to trigger InApp purchases from your application. But you are responsible for not getting into different endless cycles.
source share