Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下载文件的疑问 #10

Closed
MrVokie opened this issue Jan 27, 2016 · 1 comment
Closed

下载文件的疑问 #10

MrVokie opened this issue Jan 27, 2016 · 1 comment

Comments

@MrVokie
Copy link

MrVokie commented Jan 27, 2016

看你的断点续传的代码。有一个地方不是很清楚。

在下载过程中,当程序强制退出以后。

再次进入app,你的例子中的下载的进度是如何恢复到退出之前的?

我也尝试用通过读取序列化的对象的方法。但是读取的是上一次保存的序列化对象数据,并不是退出的那一刹那的下载数据信息。

writeDiskCache这个方法我全局搜过,似乎你也没有对强制退出App做过特殊的处理。

是我哪里看遗漏了,还请指点一二。

@MrVokie
Copy link
Author

MrVokie commented Jan 27, 2016

看到了。UIApplicationWillTerminateNotification。

也看到了

if (self.didFinishedBlock) {
            self.didFinishedBlock(self, nil , nil, YES);
            self.didFinishedBlock = nil;
        }else if (self.delegate &&
                  [self.delegate respondsToSelector:@selector(WHCDownloadDidFinished:data:error:success:)]) {
            [self.delegate WHCDownloadDidFinished:self data:nil error:nil success:YES];
        }

可是为什么我的程序正在下载的时候,强制退出,再次打开,读取序列化的数据有问题,不是退出时的下载数据信息呢,难道是程序退出时,并没有来得及保存那个operation吗?。求解释。。。。

看你的程序似乎是没问题的。

@MrVokie MrVokie closed this as completed Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant