+2  A: 

You could use an NSOperation to download a file asynchronously.

You can use NSFileManager to save the file to your application's Documents directory.

Edit:

You are trying to write to a file in your application bundle. You can't write to any files in the bundle -- it's part of the Apple security sandbox model.

You should place the file in your application's Documents directory and write to it there.

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectoryPath = [paths objectAtIndex:0];
NSString* filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"myfile.xml"];
Shaggy Frog
thanks Shaggy, your suggestions helped but I still have a small problem. I have updated my post to show what it is.
Louie
A: 

Do you have control over the XML on the server? Instead of downloading the XML file, whether or not it is different, make a SHA1 signature of the file, and compare it with the SHA1 signature of the file you have already cached.

If the signatures are the same, there's no need to burden the user with a second, senseless download (especially on WWAN networks). If the signatures are different, only then would you fire a download request in the background.

Alex Reynolds