swift - Open item from ios push notification -
i have basic push notification set done , receiving push notification in app. using parse backend.
now want open specific item app when tapping on notification. not sure how approach.
i sending itemid in notification payload.
after reading documentation understand need write code in following 2 delegate methods when app active , inactive.
didfinishlaunchingwithoptions when tapping on notification if app not active (i.e. not open or in background) want sync finish first , navigate user itemsdetailviewcontroller , shoe item based on itemid.
didreceiveremotenotification when app open want directly navigate item based on itemid in push notification. able see key/value pair of custom data sending in push notification. not sure next. how pass itemid next controller , open item.
any help/suggestions appreciated.
you're on right track. function didreceiveremotenotification: point should handle notification. deep link to.
you can modal.
let aviewcontroller = yourviewcontroller() aviewcontroller.itemid = itemid uiapplication.sharedapplication().keywindow.rootviewcontroller.presentviewcontroller(aviewcontroller, animated: true, completion:nil)
Comments
Post a Comment