Is there a way to track user response (the choice between the 'View' and 'Close') when the m开发者_如何学Cessage has been push into the user device?
Thank you.
Your app is not notified if the user clicks "Close"; but if the user clicks "View", your app is launched, and you can detect that it was launched from a notification -- the notification's payload is passed to application:didFinishLaunchingWithOptions:.
Also, don't forget about the case where your app might already be running when the notification comes in. In that case, your application:didReceiveRemoteNotification: function will be called.
Full details are here.
My strategy would be:
- Keep a record of the user's device token when your server fires a APNs notification.
- Implement the didFinishLaunchingWithOptions and didReceiveRemoteNotification methods accordingly, so that whenever the user's device becomes active due to your APNs notification, it sends a request to let your server know. This request should contain the device token.
- Your server does a look-up and match process, once such a request is received.
精彩评论