iOS 4 Task Switching Bug -- Apps and Hard Resets | Cult of Mac

iOS 4 Task Switching Bug — Apps and Hard Resets



I’ve been using my new iPhone 4 for over a week and now that I’ve had some time to explore it I’m learning a lot about the hardware and software that it came with. The iPhone 4 isn’t perfect since I’ve found a few problems with the hardware and iOS 4, but fortunately I’ve got workarounds for some of the bugs plaguing iOS 4.

One of the major new features in iOS 4 is task switching and while it is easy to use it was implemented with two flaws that I don’t think anyone is aware of. I’m going to explain both of them to you and offer workarounds until Apple comes up with a permanent fix.

Task Switching — Negative Impact on Safari Settings Reset

I recently grabbed my iPhone 4, launched Safari, and browsed to to try and opt out of Apple’s iAds. I should note that I’ve been trying to access that site and opt out of Apple advertising since June 21st and I haven’t been successful so I called Applecare today. They were puzzled by this and the fact that the site said that I could not successfully opt out.  Attached to the site was a technical bulletin that basically said come back later and try again. Yeah right I thought! I’ve been trying for over a week!

The Applecare representative told me to try resetting Safari on my iPhone 4 and I said ok I’ll try that. I pressed the Home key – sending Safari into task switching holding pattern in the background. I launched the Settings app, tapped Safari, and tapped Clear History, Clear Cookies, and Clear Cache. I answered affirmatively to all three and expected Safari to be reset.

Safari did not reset. How could I tell? That was simple since the pages I had open in it previously were still there. If it had been reset properly Safari would have opened with a blank page and displayed my bookmarks. It didn’t.

Safari Settings for Clearing History, Cookies and Cache.

I found out that in order to really reset Safari I had to kill the copy of it suspended in the background. I did this by pressing Home twice, which displayed the the suspended apps in the task switcher. I scrolled through the list and located Safari. I then tapped and held its icon until it began to jiggle and displayed a white minus sign inside of a red circle. I tapped that and and the suspended copy of Safari was closed. I pressed Home twice again to exit and return to the Springboard desktop.

Kill Safari in the task switcher (see red arrow).

I then re-entered the Settings app and performed the steps above to reset Safari. This time Safari reset as I expected it to just like it did in iOS 3.x. I was presented with a blank page and my bookmarks when Safari opened. I could have either selected one of those or canceled that dialog and manually entered a web address. All evidence of the previously opened pages was gone.

This is what you'd expect to see after a proper Safari reset.

Now this might not seem like a big deal, but I think it is since the reset feature for Safari just isn’t working if Safari is suspended by Apple’s implementation of task switching in iOS 4. That is unless you use my work around, which in my opinion you should not have to do.

This issue could also be a problem for other applications. It seems to me that way Apple implemented App suspension makes it so that the app is so frozen you cannot make changes to it while it is in that state. That included resetting Safari’s history, cookies, and cache. So keep this in mind, when you reset other apps or maybe even change their settings in the Settings app, you may want to make sure they are completely closed first.

It’s hard to tell what other problems this may present with other apps on iOS 4. The problem with Safari was noted immediately and I have yet to test other apps to see if they have the same problem. However, I honestly think this is pretty serious bug in iOS 4.

Task Switching & Suspension — Negative Impact on Hard Resets

I’ve been writing troubleshooting articles about the iPhone for over two years and one of the most recommended iPhone troubleshooting fixes was a hard reset. You perform a hard reset by pressing and holding the Sleep/Wake and Home buttons at the same time until the Apple logo appears. You would then release the buttons at the same time.

Sleep/Wake (top) and Home (bottom) buttons.

The act of doing this was the definitive way for you to reset or restart your iPhone. If some app, hardware, or iOS went into an endless loop, crashed, or  had other problems this is how you would clear it up — most of the time.

Now due to the way Apple has implemented task switching in iOS 4 you can never really reset your iPhone. If you have apps running in the background or suspended on your iPhone when you do the hard reset they are there when the iPhone finished restarting. Now tell me does that sound like the phone really reset and cleared all of its techno-cobwebs?

No, I don’t think so. My expectation would be that the iPhone would return to the Springboard desktop with no apps suspended or running in the background. The exception might be the Phone app or perhaps some other standard Apple apps that have always run in the background. I would not expect to still have my Facebook, eBay, Echofon, etc. still suspended in the task switcher.

So now a user has to do some extra work to reset their iPhone. Like the Safari example above I think a reset must be completed in several stages. If your phone is frozen you’d have to do the reset once and then after it restarted you would have to tap Home twice and kill any and all apps running or suspended in the background before performing the hard reset again. Finally, after all this extra work your iPhone would be in theory reset like it was under iOS 3.

Press the red circle to kill a currently suspended app in the task switcher.

It would be unfortunate if iOS 4 allowed a repeat of the previous problem since it may restore the app that caused the problem if it were brought out of a suspended state after the first rest. Luckily I have not seen that happen and I believe Apple has some safeguards that may prevent this.

So far these are the only big problems I’ve seen with iOS 4. Some of you may think this isn’t a big deal, but when an app or a procedure doesn’t act as you would expect it to then we have a problem. In both of these examples this is exactly what happens.

Updated 07/04/2010 at 7:39 pm CDT: Just an FYI, but if I go into an app like Settings and I push all kinds of buttons to make something happen and the whole time it lets me go on like everything is working and it doesn’t that’s a bug! In this case had the Setting’s app said something about Safari being suspended followed by a please close Safari before continuing or something to that effect I would have gladly complied. It didn’t warn me or display any kind of error about the resets failing while Safari was suspended so that’s a bug. Period!

Consider these circumstances what if I was banking in Safari on my iPhone and a friend said, “Hey can I see your iPhone 4?” You say, “Sure!” But before doing so you try to clear out Safari. Hit Home. Go to the Settings App. Etc. This bug prevents it from working, but since you got no errors you hand the phone to your friend thinking all your browser history is erased. It wasn’t and you don’t know that – no warnings. Subsequently your friend plays with the iPhone accesses Safari and discovers your bank account with a $10 million balance and now follows you around begging for a loan. Or worse you are kidnapped and held for ransom plus your iPhone 4. I could name worse examples of things you might not want people to see in your surfing history, but I’ll leave that your imagination.

Happy 4th of July!