我有以下代码:
-(IBAction)downloadButton:(id)sender{
NSURL *url=[NSURL URLWithString:@"http://93.185.34.100/prob/pic1.zip"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadProgressDelegate:progressView];
// NSString *pathString=[NSString stringWithFormat:@"%@/theZip.zip", [[NSBundle mainBundle] resourcePath]];
NSString *filePath = [[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"theZip"] stringByAppendingPathExtension:@"zip"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"Directory Contents:\n%@", [fileManager contentsOfDirectoryAtPath:[[NSBundle mainBundle] resourcePath] error:nil ]);
[request setDownloadDestinationPath:filePath];
NSLog(@"Value: %f", [progressView progress]*100);
[request startAsynchronous];
}
它应该将下载的 zip 文件下载并存储到文档目录中。当我在模拟器上运行它但在设备上不起作用时它会这样做。
问题是什么?