Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's been a month since you posted this question so I'm not sure if you still need an answer, but I solved this problem by pushing all shared "entrance logic" (as I like to call it) to <code>applicationDidBecomeActive:</code> and simply store the entrance method as state in the appdelegate object. So if I come into the app from the background, then I set one flag. If I come in through a notification, I store the notification message (so I can intelligently process the notification entrance logic). If I came in through a url, then I store that url. In <code>applicationDidBecomeActive:</code> I look to see which way I came in from. Here are the states that I watch for:</p> <ol> <li>New app instance by tapping on app icon (no state set)</li> <li>Came in from background by tapping on app icon or ending a phone call, etc (only enter foreground flag set, nothing else)</li> <li>Came in from APNS (notification data is set, note this could be either new app instance or from background)</li> <li>Came in from url (url is set, note this could be either new app instance or from background)</li> </ol> <p>With all the necessary pieces of information in one place, I can intelligently decide if I want to execute the notification entrance logic, or the simple enter foreground entrance logic.</p> <p>BTW, this flow chart is invaluable! <a href="http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/" rel="nofollow">http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload