Failed to move file error to ASIHTTPRequest

I am using ASIHTTPRequest to download a file from the server but its error

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

can any body tell mw this error what is wrong in my code ......

    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

      

+2


a source to share


3 answers


Do you already have temp.zip at this location?



+1


a source


It also happens if you set the destination path incorrectly using this method setDownloadDestinationPath:

of ASIHTTPRequest

...



0


a source


Your call [request setTemporaryFileDownloadPath: tempPath]; is unnecessary and is most likely the source of your error.

0


a source







All Articles