且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

针对用户响应的 Apple 推送通知服务

更新时间:2023-12-03 16:08:52

如果用户点击关闭",你的应用不会收到通知;但是如果用户点击查看",你的应用程序就会启动,你可以检测到它是从通知中启动的——通知的有效负载被传递给 application:didFinishLaunchingWithOptions:.>

另外,不要忘记当通知出现时您的应用程序可能已经在运行的情况.在这种情况下,您的 application:didReceiveRemoteNotification: 函数将被调用.

完整详情在这里.

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.

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.