Deep Linking iOS Push Notifications

10,644

Solution 1

Try to move your dictionary entry for view outside of the "aps" dictionary.

{
    "aps": 
    {
        "alert": "look at this stuff"
    }
    "view": "wc1"
 }

Solution 2

When application is loaded you can detect that in your appdelegate class in that method:

 didFinishLaunchingWithOptions 

NSDictionary *pushNotification = [options objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

if(pushNotification )
{
    //Handle remote notification
}

If application is still running in background and notification came, you can detect that also in your AppDelegate class:

-(void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo
Share:
10,644
James Dunay
Author by

James Dunay

Flash Developer / Objective C

Updated on June 09, 2022

Comments

  • James Dunay
    James Dunay about 2 years

    I'd like to be able to send the viewer to a specific view in the app when they get the push notification, based upon what I send them.

        "aps": {
            "alert": "look at this stuff",
            "view": "wc1"
        }
    

    the view 'wc1' is just a tag in a collection view. So what i'd really like to know is, if the user is deep in my app, and they receive a push notification, how do I send them back to the collection view screen.

    I've come across the term deep linking, but not been able to find anything on it thus far. Any direction would be really helpful. Thanks!

  • mfaani
    mfaani about 8 years
    I am a newbie on this, but isn't the placement of "view" a matter of how you implement reading your push notifications? OR is it something that we don't implement its reading and you must only follow Apple's standard way of sending push notifications?