ios - didReceiveRemoteNotification presentViewController from anywhere when running -


i'm trying present uiviewcontroller when remote notification received.

my code works point, when app running , user on other first screen/navigation stack, uiviewcontroller isn't presented.

can please? note want keep navigation bar when uiviewcontroller presented

i warning when try present 'uiviewcontroller' elsewhere

warning: attempt present on view not in window hierarchy!

thanks in advance

here code didreceiveremotenotification:

func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject]) {    var payload = userinfo   let requestid = payload["requestid"] as! string     let rootviewcontroller = self.window!.rootviewcontroller as! uinavigationcontroller    let storyboard : uistoryboard = uistoryboard(name: "main", bundle: nil)   let vc : requestviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("requestviewcontroller") as! requestviewcontroller     vc.requestid = requestid    let navigationcontroller = uinavigationcontroller(rootviewcontroller: vc)    rootviewcontroller.presentviewcontroller(navigationcontroller, animated: true, completion: nil)  } 

fixed changing:

rootviewcontroller.presentviewcontroller(navigationcontroller, animated: true, completion: nil) 

to:

rootviewcontroller.visibleviewcontroller!.presentviewcontroller(navigationcontroller, animated: false, completion: nil) 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -