ios - How to add a uiviewcontroller when the app is opened and i receive a push? -


hello receive push notification , if app active, give user alertview whether he/she wants view notification or not. if user selects "yes" present modal , these done in app delegate.

[[[[uiapplication sharedapplication] delegate] window].rootviewcontroller presentmodalviewcontroller:eo animated:no]; 

so far works fine, when in app , on presented modal following warning :

warning: attempt present <abcviewcontroller: 0x201f27f0>  on <swviewcontroller: 0x1f58c330> presenting <uinavigationcontroller: 0x201d3050> 

and dont see window presented modally.

a controller can have 1 modal presented @ time. potential quick fix dismiss potential modal first, before showing new one:

// dismiss [self.window.rootviewcontroller dismissviewcontrolleranimated:no completion:nil];  // present [self.window.rootviewcontroller presentviewcontroller:controller animated:yes completion:nil]; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -