UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification not always triggered in Unity iOS App
How do you guarantee that the object from the code sample exists during whole application lifecycle? Most likely, it's deallocated at some point of execution, that's why it doesn't receive the notifications. iOS itself guarantees that the app always receives at least UIApplicationDidBecomeActiveNotification
and UIApplicationWillResignActiveNotification
.
P.S.You subscribe for notifications in init
method. And unsubscribe in appWillTerminate
. A better place to unsubscribe would be dealloc
.