开发者

How to download zip file to iphone?

I'm trying to download a zip file. It returns 0 bytes for myURL1, this code works for a xml file which returns roughly 200000 bytes.

NSURL *myURL1 = [NSURL URLWithString:@"http://www.enginbodur.com/files/GetAccounts.zip"];
NSURL *myURL2 = [NSURL URLWithString:@"http:/开发者_JS百科/www.jjfoodservice.com/rss/productscatalogue.xml"];

NSData *myData = [NSData dataWithContentsOfURL:myURL];

Can someone show me how to download zip files from a url?

Thanks


This should work, but is inadvisable. Your code will block while the file downloads, very bad practice. Learn how to use NSURLConnection instead.


NSURLConnection would indeed be a better solution. also, might sound silly, have you tried it with the url all lowercase?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜