简体   繁体   中英

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.

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.

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. 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

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

The above links provide a way to structure your app so that custom urls are able to open the app into any part. If there is only going to be one extra entry point, there is probably not much point re architecting your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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