Quote:
Originally Posted by Jaxen66
Hi everyone!
I have been trying to implement a function that will hide all ads in my app but every time my app starts again the ads are showing. I have read somewhere that i have to use NSDefualtUser, but that just messed up somethings.
I have setup'ed the in app purchase and checked that it is working correctly with apples servers. So basicly i just need some advice and tutorials on how to hide the ads and get the app to remember that the product have been bought!
Looking forward to hear from someone! 
|
Dude,
A post like yours makes me want to run the other way. You are vague, can't write grammatical sentences, and can't get class names correct. Learn to be clear, and use the correct terms for things.
You said:
"I have read somewhere that i have to use NSDefualtUser, but that just messed up somethings."
It's NSUserDefaults. What do you mean "that just messed up somethings?" What, exactly, did you try? How did it "mess up somethings?"
NSUserDefaults is an easy way to save data that persists between runs of your application.
When the user makes the purchase to turn off ads, do something like this:
Code:
#define k_turnOffAds_key @"turnOffAds"
Code:
NSUserDefaults *defaults = [NSUserDefaults standardDefaults];
[defaults setBool: TRUE forKey: k_turnOffAds_key];
[defaults synchronize];
Then, when you want to see if the user has paid to turn off ads:
Code:
NSUserDefaults *defaults = [NSUserDefaults standardDefaults];
BOOL adsAreOff = [defaults boolForKey: k_turnOffAds_key];
if (!adsAreOff)
{
//display ad
}