Persistence unnecessary in iOS 4.0? - persistence

I noticed that when the home button is pressed on the iPhone simulator to exit an app and then the app is re-entered it starts off right where it left off. Does this mean that programming persistence is no longer necessary? What if the user presses the power button on their ipod touch?

There are still several cases to mention, which should make it clear that persistence is still necessary!
The Target Device doesn't run iOS4
The Target Device runs iOS 4 but doesn't support Multitasking (like the iPhone 3G)
iOS terminates your background app when it's running out of memory
The App crashes
The Target device reboots
The User manually terminate your app via the "Task Manager"

I'm not fluent with the details, but my understanding is that the application is put to sleep. Just like closing the lib on a Macbook. Persistence is definitely required because your data is not preserved and therefore a power off or application kill will loose it.

If you double click the home button you can see the current app running in background, here you can close an app.
Hower there are some device that can't support multitasking: iPhone 3g and early iPod touch.
Last but not least don't forget that there are a lot of device that still have 3.x iOS version.

Related

IPhone - Application behaving differently after some time in background

I would like you to help me here.
I'm developing an app that works in the background. It's a location-based app and I think I'm going crazy because when I'm debugging the app in the device it works perfectly, I make it sleep I wake it up and I works as expected. Then I unplug the device from the computer and I put in my pocket and whenever I open it, it sometimes works and other it doesn't, I'm talking about several hours in the background.
Are there any known issues about this? My device is running iOS 5.0 and I'm developing for iOS 4.0
Thanks
Applications in the background are handled by iOS. Therefore if iOS "thinks" that it needs memory it maybe frees some of the memory your app needs to run.
Have you tried to look into it with Instruments?

iOS platform: Running application on background

am new to the ios application development.
I had developed an application on iOS platform using 4.3 SDK.
When it runs on simulator or a device, if we are trying to press on the application icon again after quit the application at run time, the application is again starts its execution from the begining, not from the previous stage it has stopped.
By going throgh the documentation i came to know the multitasking facility is inbuilt for an iOS application.
Or we need to do any coding for implementing this multitasking facility.? Experts please help.
Thanks in advance.
Basically you should be able to go background and then foreground when using the simulator. remember that when running on simulator the GDB debugger is attached to the process thus you cannot terminate the app and start again but you can go background and start again. I think there is a good chance you are crashing and that's why the app starts again. Try to implement the app delegate methods "didResignActive" and "didBecomeActive" and make sure you manage the saving of the state correctly there...

Is it possible to find the location from background in iPhone 3G, 3GS

I am making an app in which i need to find the location from background when userpress the home button, my app works fine on iPad2 and it gets updated,however its not working on iPhone, apart from iPhone 4, previous version of iPhone, is it possible to track update on that older version of iPhone leaving iPhone 4
As Badgerr commented, iPhone 3GS was the first version of the iPhone to support multi tasking. Previous versions of the iPhone are not capable of tracking the user location without the app running in the foreground. As soon as a third party app enters the background it gets closed.
http://support.apple.com/kb/HT4211:
Multitasking in iOS 4 is supported on iPhone 3GS or later, iPod touch
(3rd generation or later), and all iPad models.
Since you mention that your app is running on iPad and iPhone, I assume that you are not asking about how to get the location when the app is running in background and that you are doing correctly as explained here.
As to the rest, your problem may have to do with background processing being only available starting from iOS 4.0.
So, more than the specific model of iPhone, what matters is the iOS version that is installed on your device (or if it can be installed).

Make a call from iPhone application without quitting

Is it possible to make a call from application with out quitting application in iOS 4?
You will have to have your application remember its state. That way it can be resumed when launched again. Even with the new multitasking your suspended apps may be forcibly quit if the device needs more memory.
Apple has a guide named "Supporting Multitasking In Your Applications" which you should be able to locate.
Related SO: Does iOS 4 make “Real Multitasking” available to 3rd party developers?
However, you may not replicate core OS functionality so this is the only way to get what you want.

What are the implications of multi-tasking in iOS 4.0 for developers?

I just watched this video from Apple that shows multi-tasking on the new iPhone (running iOS 4.0). What are the implications of multi-tasking to developers? Include both positives and negatives.
For example what happens if the user decides to launch two resource-intensives apps at the same time, one of the apps crashes and progress in a game (for example) is lost. Should developers be considering this when writing apps for the new OS and phone?
For example what happens if the user
decides to launch two
resource-intensives apps at the same
time, one of the apps crashes and progress in a game (for example) is lost?
One of them will run on foreground. If the system gets thin on resources, it will terminate the one running in background. The application always gets a chance to save its state.