Error domain = asihttprequesterrordomain code = 8 "failed to move file from" xxx/XXX "to" xxx/XXX"

Source: Internet
Author: User

I am so happy today that I have solved a problem that has been suffering me for a week. I am so excited that I am crying. For this problem, my mouth is broken and my hair is caught. Although the solution shows the greatness of "Baidu", I am still very happy. Here I will show my results

The problem is that downloading the zip package under 2 GB does not fail every time, but it will fail as long as I leave the current page and enter the current page again (enter requestfail ), if you just leave and do not enter, it will work normally together.

How strange it was. At first I wanted to see if I had performed any mean operations after entering the page, which led to the ASI strike, but finally I gave up, I did not have any operations on the ASI. I found a new way out because I did not write it.

In fact, it's my own words. Since I can't find them, let's proceed from the actual situation and print the error of requestfail, something came out, "error domain = asihttprequesterrordomain code = 8" failed to move file from "xxx/XXX" to "xxx/XXX" ", saying that something went wrong with file movement, so Baidu and Google started to solve the problem and found that there were not many people who encountered the problem. But fortunately, some people answered their questions and gave a vague solution to the problem, that is, it saved my life. For more information, see "http://www.cocoachina.com/ask/questions/show/107449/asihttprequestdownloadfileerror"

However, what this buddy said is too vague. I first tried to cancel the settings of the two paths according to his method, and the result was actually entered requestfinish, so the download was successful, but how can I get the downloaded content? Don't talk to me about [Request responsedata]. The first attempt was that the result was null. In fact, I thought of it myself. His own answer seemed like there was a function that could be used, so I looked at the ASI function and found it for me.

- (void)setDataReceivedBlock:(ASIDataBlock)aReceivedBlock;

I was excited when I saw this function.

Concatenate the received data in the function and write the data to the folder on finish. (_ Saved eddatadic is used to save the combined data)

[request setDataReceivedBlock:^(NSData *data)    {        NSMutableData *oldData = nil;        if ([_receivedDataDic objectForKey:key]) {                        oldData = [_receivedDataDic objectForKey:key];                        [oldData appendData:data];        }else        {            oldData = [NSMutableData dataWithData:data];        }             [_receivedDataDic setObject:oldData forKey:key];            }];

I will not describe the data writing folder below.

-(void) requestFinished:(ASIHTTPRequest *)request

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.