Search code examples
ios4uilocalnotificationlockscreen

redraw GUI on didreceivelocalnotification when come from lock screen iphone


How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?

Also the order of events I get when I come back on local notification from background is as following:

1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification

When I come from lock screen:

1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification

Why is this difference and whether there is something else I'm missing?

Thanks


Solution

  • Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.