Reputation: 41
I wanted to show a message to users at the start of the app just before showing the push notification permissions alert view. In order to determine whether I should display the message, I need to know whether user has seen the push notification permissions alert view before.
Upvotes: 3
Views: 1086
Reputation: 157
You can use NSUserDefaults.
After you call regusterNotifications: which shows the permissions.
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"hasShown"];
[[NSUserDefaults standardUserDefaults] synchronize];
To check if it has shown, assuming that means the Boolean value for hasShown is Yes.
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"hasShown"])
// user has seen before
Note that this only checks if the permissions request has been sent before. This does not validate whether your push notifications is still activated for the given app.
Upvotes: 3