开发者

iPhone store remote server images

According to a couple of different postings here on SO "storing images in the database is definitely not recommended by Apple, the filesystem is actually really good at locating files (images in this case) on the disk, which makes it the best solution for saving images." link text

I'm currently retrieving data from a remote db using PHP / MySQL & JSON. How would I go about grabbing images that are currently in the form of "http://remoteserver.com/myImage.png" and save them to the files system of my app so that they can be viewed without internet connectivity?

Thanks for reading this and thank-you for your ti开发者_如何学运维me.


You can download the images using the NSURLConnection class. After following the example in the documentation, you can save out the NSMutableData to a file using the - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag method.

See this page in the Apple developer documentation for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜