Highlight a push notification handler when the application is front and background

They say that (correct me if I am mistaken) if the application is in the foreground, we should handle push notifications in "didReceiveRemoteNotification", and if the application is in the background using "didFinishLaunchingWithOptions" when the user removes the "View" button applications. Since I don’t have a phone for testing, I want to know if I am doing this correctly.

1) What will be called up when I click the "View" button in the push notification?

2) Suppose I run the application in the foreground and at the same time notify the push notification. Will a warning message be received? If so, what happens if the user clicks the View button?

3) In this thread How to handle push notifications if the application is already running? it says:

The "alert" key will not be directly under the userInfo dictionary, you need to get another dictionary named "aps", and then get the "warning" or "body" from the dictionary "aps"

It's true?

4) I need to click on a specific view when the user clicks the View button. Therefore, do I need to process this code in both methods?

thank

+3
1

, push- Apple vid: http://developer.apple.com/videos/iphone/#video-advanced-pushnotification - , iTunes.

: http://developer.apple.com/itunes/?destination=adc.apple.com.3391495696.03391495702.3416205190?i=1378617410

  • , , , didFinishLaunchingWithOptions, , didReceiveRemoteNotification.

  • , . didReceiveRemoteNotification, UIAlert, .

  • - .

  • , , , , . didFinishLaunching ( ), didReceiveRemoteNotification. , , , , get-go ( , - ).

+2

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


All Articles