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"];