iphone - ASIHTTPRequest 中无法移动文件错误

标签 iphone cocoa asihttprequest

我正在使用 ASIHTTPRequest 从服务器下载文件,但出现错误

Failed to move file from '/Users/admin/Library/Application Support/iPhone Simulator/3.1.3/Applications/8650FFE4-9C18-425C-9CEE-7392FD788E6D/Documents/temp/test.zip.download' to '/Users/admin/Library/Application Support/iPhone Simulator/3.1.3/Applications/8650FFE4-9C18-425C-9CEE-7392FD788E6D/Documents/test.zip'

任何人都可以告诉我这个错误我的代码出了什么问题......

    NSURL *url = [NSURL URLWithString:@"http://wordpress.org/latest.zip"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];

NSArray *dirArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,    NSUserDomainMask, YES);

NSString *path = [NSString stringWithFormat:@"%@/test.zip", [dirArray objectAtIndex:0]];

//NSString *tempPath = [NSString stringWithFormat:@"%@test.zip", NSTemporaryDirectory()]    ;

NSString *tempPath =[NSString stringWithFormat:@"%@/temp/test.zip.download", [dirArray objectAtIndex:0]];

// The full file will be moved here if and when the request completes successfully
[request setDownloadDestinationPath:path];
[request setTemporaryFileDownloadPath:tempPath];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestWentWrong:)];
[[self queue] addOperation:request]; //queue is an NSOperationQueue

最佳答案

您在该位置已有 temp.zip 吗?

关于iphone - ASIHTTPRequest 中无法移动文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2857172/

相关文章:

android - 在 Android 设备上拍摄视频并在 iOS 设备上播放

ios - 如何使用 ReactiveCocoa 处理无效 token

objective-c - Cocoa - View 处理的解释

objective-c - 如何获取 NSWindow 标题栏的颜色,特别是当窗口失去焦点时?

ios - 在 ASIHTTPRequest 中设置 header

ios - ASIHTTPRequest 在 iOS 3.1.3 上崩溃

iphone - 使用的套接字上的 NSStream SSL

iphone - 如何加载 XIB?

objective-c - 如何从 cocoa 中的 CFTypeRef 获取窗口号?

ios - 使用ASIHTTPRequest下载PDF,模拟器可以,但是设备出现ASIHTTPRequest错误