How to download files from internet and save in 'Documents' on iPhone?
问题 I have a folder on my remote server that has a few .png files in it. I want to download these from within my app and store them in the apps 'Documents' folder. How can I do this? 回答1: The easy way is to use NSData's convenience methods initWithContentOfURL: and writeToFile:atomically: to get the data and write it out, respectively. Keep in mind this is synchronous and will block whatever thread you execute it on until the fetch and write are complete. For example: // Create and escape the URL