Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

didReceiveRemoteNotification not called

I'm getting crazy with apns problem.

I'm testing apns push notification. I could get push messages well.

But now something is big problem. I'd like to tell my circumstance like below.

  • When my app is running, didReceiveRemoteNotification is called well.

  • When my app enter background, and got a push message, and then if I touch my app,

    1. didFinishLaunchingWithOptions NOT called.

    2. didReceiveRemoteNotification NOT called.

    3. ONLY applicationDidBecomeActive is called.

So, how could I display arrived push message under circumstance like this?

I couldn't access (NSDictionary *)userInfo object in applicationDidBecomeActive method.

I couldn't find any API for accessing userInfo.

It's nonsense that I can't access to arrived push messages when become foreground from background.

So should I retrieve the message from my server again? If I should do like this, why does push message architecture exist? It's unreasonable.

like image 434
user1250080 Avatar asked Aug 23 '12 02:08

user1250080


1 Answers

Opening the app by tapping the icon will never give you information about previous notifications. It's only if you actually open the app via a notification that you will be able to access the notification data.

If you tap the icon, how would the app know which notification you are responding to, if there were multiple recent notifications? How would the app know the user is even responding to a notification at all, and not just opening the app for another reason? Notifications are not designed to do what you want.

See iOS Push Notification - How to get the notification data when you click on the app icon instead of notification for more discussion.

like image 178
Jeff W Avatar answered Oct 24 '22 03:10

Jeff W