in my iPhone app, I am using the default NSFileManager to copy and move some data around. The amount of data may be some MB, so it may take several seconds to finish copying. If the user now starts a copy process and quits the application, can I continue writing to disk in background mode? If so, how? I do not want to start a new copy process, but only finish the running one.
I am currently using two kinds of method calls:
[imageData writeToFile:path atomically:YES];
and
[fm copyItemAtPath:sourcePath toPath:destinationPath error:&error];
Both calls are wrapped in another method and are performed in the background via -performSelectorInBackground:withObject:
.
Another question is if I can get any information on how far the writing operation has progressed or at least if it has already finished?
EDIT: Some more information: Currently, I did not implement any background tasks at all. What happens to running disk operations when the user presses the home button? Are they just cut off and the file is incomplete? Can I continue writing on the next start? Are they canceled and the incomplete file is removed?
To sum it all up: I am writing data to disk and I want it to stay consistent when the user presses the home button during a writing operation. How do I achieve this?