Search code examples
iosuiwebviewcontrol-center

App breaks after sliding in the Control Center, leaving and coming back fixes it


Has anyone ever had this issue:

When you slide your finger from the bottom of your iOS screen to the top, it shows the control center - and then you swipe your finger down to get rid of it, but now when you try to use your app - a lot of the dynamic content is completely broken.

After pressing the home button and coming back to the app, everything is back to normal.

It appears the Control Center breaks my dynamic code - which is basically just a UIWebView that I'm assuming is not refreshing properly.

Does this have something to do with the "app entering the background" and "coming back to foreground"... or is there some sort of event where I can track what's going on?

This is a very strange issue.


Solution

  • It seems I was improperly using "applicationWillResignActive" when I really wanted to use "applicationDidEnterBackground".

    By making sure to use "applicationDidEnterBackground" instead of the "applicationWillResignActive", my app appears to function perfectly fine again. Viewing the Control Center or Notification Center no longer breaks my app.

    Hope this helps someone else who makes a silly mistake.