applicationDidBecomeActive not called while other delegate are called normally - ios

Like title, I'm facing a really strange bug on some my user device. I've search but I cant find any exactly same problem like me.
Here's some more detail about this bug:
applicationDidBecomeActive is not called but other delegate (didFinishLaunchingWithOptions, applicationWillEnterForeground, applicationDidEnterBackground,...) are called normally.
Bug disappear when restart device.
Not always happen, all is working normally and then suddenly this bug appear and break my app flow.
When my app is having this bug, other app are facing same bug too if they are using applicationDidBecomeActive to do something important (like Facebook Messenger as I can see, it cant reset unread message and badge number).
I believe this is an iOS system bug, anyone can confirm it? If not, how do I fix that?
Thanks!

Related

Make something happen when app opens from background?

I want to run a function when my application opens from the background (after someone has pressed home button and reopened the app).
I have been told to look into "NSNotificationcenter" and "applicationdidbecomeactive", but I have no idea how to use those. And yes I have been searching online.. Can anyone please help me with this one?
In your Appdelegate class there are methods which invoke on app becoming active and going to background.Do code in them to do things which you want to do when the app goes to background or becomes active.

iOS: not getting touchesCancelled when getting a native popup

I'm not used to working on native iOS code. So excuse me for missing something obvious here.
The issue I'm having right now, is when a user is holding down a touch, and then before releasing, a native popup appears (low battery, timer, ...), this does not fire a call to touchesCancelled.
Instead, it fires a touchesEnded when the user stops touching the screen.
However, this touchedEnded was a user reaction to the popup, not an active decision for using the app, and this might lead to incorrect and frustrating behaviour.
As far as I can tell, the touchesCancelled should be fired when focus is lost, but it seems focus is not completely lost in this case.
I am wondering if there is any other way to detect that a native popup was opened, and have my app act like touchesCancelled was fired, and avoid unintentional behaviour.
I've tested some apps from Apple and they have the same (in my opinion) wrong behaviour. So maybe it's something I have to live with, but I want to reach out to more experienced native iOS devs, and be sure of it.
Thanks,
Sascha
I returned back to this issue today. I found out that when a native popup appears, there is a call into the app to applicationWillResignActive and applicationDidBecomeActive respectively.
In my solution, at the moment applicationWillResignActive is called, I basically make the app act as if there was a touchesCancelled for each touch that had a began without an end or cancel. When the actual touchesEnded gets called, it gets ignored as it no longer matches a touchesBegan in my app.
It feels a bit like jumping hoops, but this does the trick quit nicely for me.

App view seems to reload back to default after some time

I've come across a strange error while programming my iPhone application. Basically when I leave my application in the background and then access it after a long time (i.e. the entire night while I'm sleeping), the viewDidLoad method seems to be called again even though I did not exit the app (I only double tapped the Home button or I tapped the Home button once) but still left the app in the background. However, if I leave the app on for a short period of time (anytime between a few minutes to a few hours), the viewDidLoad method is not called again and everything is as it should be. After doing some research, I found that it is because the viewDidUnload method is called (after the OS finds that the app is suspended for a long time), which calls viewDidLoad again when we bring the app back up. I found this out through this link: view seems to reload itself but it doesn't seem that there's a way to prevent viewDidLoad from being called when the viewDidUnload is called. Is there any way to prevent this viewDidUnload method from being called again? The thing is I want my app to be running for a long time in the background (i.e. a few days in the background) to collect data. Or, is there no way around this? Any help would be appreciated. Thanks!
EDIT: I have realized that after iOS 5, viewDidUnload is deprecated but this phenomenon still occurs. Any ideas on how to fix it? Thanks!
If you want to do stuff in the background you should look into background tasks.

Should touchID be displayed if app minimized

Im implementing touch ID to "unlock" my app, and im not sure if ive run into an apple bug or something i need to handle myself. If i tap the Home button and minimize my app before evaluatePolicy can load the Touch ID prompt, it appears over the home screen.
![not enough reputation to display screenshot, so heres a link]https://www.dropbox.com/s/zrhc60lx87ze7mt/IMG_0016.PNG
Successful/failure/cancel evaluation of this policy does nothing, but when i re-enter the app and cancel it again, touchID seems to be disabled forever until i restart the phone.
Anyone else running into this issue or have an ideas?
P.S. Theres an open radar where errSecUserCanceled is never returned from a cancel button tap, so right now i fall into my errSecAuthFailed case, which could also be the cause.
Answer is no. It should not be be displayed, when minimized.
The problem is IMHO that the code segment is being called again from your app when it goes to the background. For example loadView , didLoad and so on.
Try moving the code, that calls the authentication somewhere else in the program (different method).
For example, if your code uses a textView to enter password, you can implement the authentication within keyboardWillShow or similar.
Hope it helps.

Does the AdInsterstitialAd no longer work with iOS 7?

I have an iPad application where I have integrated the AdInsterstitialAd but it looks like the delegate method:
-(void)interstitialAdDidUnload
is no longer called when closing the ad in iOS 7. I wanted to know if anyone else has experienced this issue or has found away around this? The unload method is important for me because that is when I want to resume my app's timers (the app pauses itself while the ad is displayed).
I have looked on Apple's website and haven't found anything useful and their current InterstitialAd sample has the same issue.

Resources