Skip to content

Conversation

@NJHu
Copy link

@NJHu NJHu commented Feb 27, 2018

- (MJDownloadState)state
{
    // 如果是下载完毕
    if (self.totalBytesExpectedToWrite && self.totalBytesWritten == self.totalBytesExpectedToWrite) {
        return MJDownloadStateCompleted;
    }
    
    // 如果下载失败
    if (self.task.error) return MJDownloadStateNone;
    
    return _state;
}

#pragma mark - 状态控制
- (void)setState:(MJDownloadState)state
{
    // MJDownloadState oldState = self.state; 
   // 修改后:
       MJDownloadState oldState = _state; 
    if (state == oldState) return;
    
    _state = state;
    
    // 发通知
    [self notifyStateChange];
}

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

Successfully merging this pull request may close these issues.

1 participant