ios - Opening browser when push notification is tapped -
i want open browser when user taps push notification.
in app delegate have:
func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { var json = remotenotif[uiapplicationlaunchoptionsremotenotificationkey] as! nsdictionary storyboard = uistoryboard(name: "main", bundle: nil) self.window = uiwindow(frame: uiscreen.mainscreen().bounds) let navc = storyboard.instantiateviewcontrollerwithidentifier("mainnav") as! navviewcontroller let data = json.objectforkey("data") as! nsdictionary let url = data.objectforkey("url") as! string uiapplication.sharedapplication().openurl(nsurl(string: url)!) self.window?.rootviewcontroller = navc self.window?.makekeyandvisible() }
when user taps push notification gives me black screen 20 seconds, app opens, , browser opens. how can make tap on push notification open browser, or @ least open faster 20 seconds?
thank you.
you can't open app directly - can use fast app switching. 20 seconds black screen sounds strange - consistent across multiple devices?
if - should run instruments , see functions take such long time work. sounds loading before app appears heavy reason.
if instruments doesn't give (and i'm pretty sure will) should @ link app agains - gigantic list of frameworks?
as quick hack in case loading storyboard heavy part - can try openurl before loading storyboard.
make sure shouldopenurl method in app delegate efficient , not doing synchronous network tasks or funky that.
Comments
Post a Comment