I am working on this idea where I want an UIAlert to pop up after a certain amount of launches of the app (let's say after 20 launches).
And there's going to be 2 buttons. One that will reset the counter which will make the alert appear after another 20 launches. And one button that will make it disappear and never appear again.
How I would do this?
Take a look at NSUserDefaults to store a count of the number of times the app has started.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
uint count = [defaults integerForKey:@"num_launches"];
if (count > 20) {
// Show alert
} else {
count ++;
[defaults setInteger:count forKey:@"num_launches"];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With