Ajay Singh Beniwal
Ajay Singh Beniwal

Reputation: 19037

IOS push Notifications Deep linking?

I have implemented Push notifications and deep link in my app in traditional method using lot of switch cases and creating controller objects and redirecting to that controller but now code is getting unmaintainable because of lot of new scenario.

So I want to know how to handle deep link with push notifications, can URL Schemes work in my case and if URL schemes can work what payload should I send in the push message.

Upvotes: 2

Views: 2989

Answers (1)

Kristin Harkness
Kristin Harkness

Reputation: 82

I just did this for my app. It all hinges on how your app is architected, i.e. how you navigate. Our app has a set of "home" pages, i.e. the top level things you can do. We already had the ability to navigate from anywhere back to a home page (by popping the current VC stack and closing any/all modals and then going to the new home page). To that, we added that as each VC loads, it checks state and sees if there is something it should do (configure itself, or push another VC). Once a VC has acted on state which applies to it, it clears that state.

Once you have built your mechanism to navigate to a particular spot, when you receive a push you just set your state and call whatever function navigates you back to the home page. Then that page checks state, does the right thing, and so on.

Upvotes: 1

Related Questions