I did a very small app which downloads files from a server. iPhone 4 supports background processing of the app that is the app goes in background when user switches it.
Here is my question, if my small app developed on iOS 3.1 based stuff (build to 开发者_开发技巧phone by changing to iOS 4) is allowed to run in background, will my app still continue download procedure ? Or should I write specially for iOS 4 for using the background processing capability.
You need to explicitly write code that allows your app to run in the background. It does not happen automatically. That means that until you change your app, it will run no different than under iPhone OS 3.1.
To learn how to enable your app to run in the background, see the excellent WWDC videos on multitasking on the Apple developer website.
As always, the docs are excellent on this. In short, though, your app may be permitted to maintain its connections and continue downloading, but there's no guarantee that you won't get the rug pulled out from under you. So you should handle the callbacks to your App Delegate that relate to background operation. And you should terminate all non-essential network operations as soon as you are made aware that you will be going into the background.
精彩评论