简体   繁体   English

通过解析通过iOS Push Notification进行深度链接

[英]Deep Link with iOS Push Notification via Parse

I'm attempting to deep link from a Push Notification into a part of my app. 我正在尝试将推送通知深层链接到我的应用程序的一部分。 I have a messages section in my app, and I want to link right into the message VC that correlates to the Push that was sent. 我的应用程序中有一个消息部分,我想直接链接到与已发送的Push相关的消息VC。

This is what I have done so far, but I'm not sure if I am even on the right path. 到目前为止,这是我所做的,但是我不确定自己是否走在正确的道路上。 The APN comes from Parse, in JSON in what I believe is a NSDictionary. 我认为NPNictionary是APN来自JSON中的Parse。

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    if let aps = userInfo["aps"] as? NSDictionary {
        if let vc = aps["vc"] as? NSDictionary {

            if vc == "messages" {

                if let message = aps["link"] {

                }

            }

        }

    }
}

Am I on the right path here? 我在正确的道路上吗? Any Suggestions? 有什么建议么?

Thanks! 谢谢!

You are able to do it the way you proposed. 您可以按照建议的方式进行操作。 Like anything you are able to do it multiple ways. 像任何东西一样,您可以通过多种方式进行操作。

Your current path means you will extract and parse the json data. 您当前的路径意味着您将提取并解析json数据。 From there spin up the correct view from your app delegate (or segue from the initial view). 从那里开始,旋转您的应用程序代表的正确视图(或从初始视图中筛选)。

If you decide you need an architecture where your app has multiple entry points, there are frameworks that will help you do it. 如果您决定需要一个应用程序具有多个入口点的体系结构,那么可以使用一些框架来帮助您。

Bolts Frameworks: https://github.com/BoltsFramework/Bolts-ObjC Bolts框架: https//github.com/BoltsFramework/Bolts-ObjC

Programmable web had a good article on deep linking: http://www.programmableweb.com/news/how-to-implement-deep-linking-ios/how-to/2015/07/14 可编程网络上有一篇关于深度链接的好文章: http : //www.programmableweb.com/news/how-to-implement-deep-linking-ios/how-to/2015/07/14

The above links provide a way to structure your app so that custom urls are able to open the app into any part. 上面的链接提供了一种构建应用程序的方法,以便自定义URL可以将应用程序打开到任何部分。 If there is only going to be one extra entry point, there is probably not much point re architecting your app. 如果仅会有一个额外的入口点,那么重新架构应用程序可能没有太多的意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM