Ryan Romanchuk Ryan Romanchuk - 1 year ago 189
iOS Question

How to determine in applicationDidBecomeActive if triggered from a notification or springboard?

I have seen similar questions with answers stating to check the

, but i'm asking how to detect a user that has already launched the app previously. In other words, how do i detect an icon tap vs push inside
func applicationDidBecomeActive(application: UIApplication)

Answer Source

There are a bunch of calls in the app delegate for notifications. If they don't get called, you were started some other way (not necessarily Springboard -- could be app-switcher, a deep-link URL -- perhaps other ways in the future).

Those should be called before applicationDidBecomeActive, but if not, you will have to delay until you find out if they are going to be called.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download