Apple Push Notification Service on user response

跟風遠走 提交于 2019-12-13 01:56:57

问题


Is there a way to track user response (the choice between the 'View' and 'Close') when the message has been push into the user device?

Thank you.


回答1:


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.




回答2:


My strategy would be:

  1. Keep a record of the user's device token when your server fires a APNs notification.
  2. 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.
  3. Your server does a look-up and match process, once such a request is received.


来源:https://stackoverflow.com/questions/4655053/apple-push-notification-service-on-user-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!