Are push notifications stored somewhere on iphone?

37,623

Push notification is not stored into application memory. But you can handle them as you want. There are mainly two case in which we need to handle the push notification:

1) Application is closed/background mode 2) Application is active mode

1) To Handle push when app is not running or in background, you need to click on push notification pop and it will open the application. Below is the code to handle this case:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
        self.isNoti = TRUE;
        NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]];
// Do you stuff
    }
    return YES;
}

2) If your application is in active state:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
    @try {
        NSLog(@"Push Notification!!!");
}
Share:
37,623
peekpoke
Author by

peekpoke

Updated on July 05, 2022

Comments

  • peekpoke
    peekpoke almost 2 years

    If yes, how it's possible for the user to re-read them again ? By coding, how do you read them to display them in your app ?

  • mjmayank
    mjmayank over 7 years
    You can change the sort order in Settings->Contacts->Sort Order to make it sort by first name