How to get a push notification when a user directly clicks an application?

When a push notification appears, the user immediately clicks the application, the push notification remains in the notification center. How can I get a message from the notification center? I want to get it and save it locally so that users can view them later.

I can save a push notification if I click on a warning from the notification center when a push notification arrives. or I can save a push notification when the application is running.

in AppDelegate.m

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];

    //save the alert
    [FunctionNSObject savePushNotification:userInfo];
}

in MyTableViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];


    //load push notification from file
    sortedMessages = [FunctionNSObject loadPushNotification];
}
+4
source share
2 answers

- push- , (, ), . , , , , , , - , , - . APNS - , .

, Facebook Whatsapp, , , APNS "", .

​​, APNS, APNS , , , , .

+1

didFinishLaunchingWithOptions

if ([[launchOptions allKeys] containsObject:UIApplicationLaunchOptionsRemoteNotificationKey]) {

        id userInfo=[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

    }

, ,

+2

Source: https://habr.com/ru/post/1539221/


All Articles