推送通知警报处理
我有一个疑问。我正在构建一个应用程序,其中如果提交了新请求,我会在应用程序中收到推送通知,并且点击推送通知警报中的“查看”按钮时,我需要显示请求详细信息页面。现在,通常该请求详细信息页面是堆栈中的第五个视图。我应该如何处理这个问题?我应该在进入详细信息页面之前初始化前 4 个视图并将它们放入堆栈中吗?
此外,还有一种情况是,如果有人正在处理应用程序的某些部分,就会出现通知。如果点击“查看”,我是否应该松开当前打开页面上的更改并显示请求详细信息?
我应该如何处理这个问题?
I have a doubt. I am building an application wherein if there is a new request is submitted I am getting a push notification in my application and on tap of "View" button in the push notification alert I need to show the request detail page. Now, normally this request detail page is 5th view in the stack. How should I handle this? Should I initialize first 4 views and put them on the stack before going to the detail page?
Also, there is a scenario where if someone is working on some part of the app and notification comes up. In that should I loose the changes on the currently opened page and show the request details if "View" was tapped on?
How should I handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您只需推送该视图(通常的第五个视图)即可。唯一的事情是,当您弹出该视图时,它现在将充当第二个视图,因此无需再经历 4 个额外的视图。
You can just push that view (the usual 5th view). The only thing is that when you pop that view, it will now act as the 2nd view, so theres no need to go through 4 additional views.
您可以初始化 5 个视图并将其推送到导航控制器(使用
animate:NO
),以便在正确的位置启动应用程序。至于您在运行时是否收到通知,这完全取决于您以及最适合应用程序的方式。您始终可以在删除任何数据之前提示用户。请注意,如果您收到推送通知,则会显示您的
application:didReceiveRemoteNotification:
而不 警报。You can initialize and push the 5 views to your navigation controller (with
animate:NO
) to start the app up in the right place.As for if you get a notification while running, that's really up to you and what is best for the app. You can always prompt the user before deleting any data. Note that if you get a push notification, your
application:didReceiveRemoteNotification:
instead of the alert showing.这通常是通过模态显示控制器来实现的。
这样,您不必重新创建视图控制器层次结构,并且如果应用程序正在运行,您也不会丢失应用程序的当前上下文。用户点击某个“确定”按钮并返回到上一屏幕。
This is commonly achieved by displaying the controller modally.
This way you don't have to recreate your view-controllers hierarchy and you don't lose the current context of your app if it was running. The user taps some "OK" button and returns to the previous screen.
对于问题的第一部分:如果您以解耦的方式创建了视图,也就是说,如果它不依赖于其他 4 个视图,那么我想您可以毫无问题地显示此视图。显然,答案实际上取决于您的业务规则是否允许这样做。
至于问题的第二部分:您始终可以向用户显示 UIAlertView ,询问他们是否要对收到的推送通知采取操作。
但是 - 我认为这些问题确实与推送通知的性质没有任何关系,您确实应该放弃问题中的“我对推送通知有疑问”部分:) ....
希望这会有所帮助: )
For the first part of your question: if you have created your view in a decoupled way, that is, if it is not dependent on the 4 other views - i suppose then you can show this view without problems. Obviously the answer really depends whether your business rules allow this.
As for the second part of your question: you always can show an UIAlertView to your users asking whether they want to take action on the received push notification.
However - i think these problems really do not have anything to do with the nature of the push notifications, and you really should loose the "I have a doubt on push notification" part of your question :) ....
Hope this helps :)