進出口工作的一個項目,我的一個UIWebView類需要代表沒有被正確設置
我使用的是開源項目https://github.com/robertmryan/download-manager
當這個代碼執行的方法,從我DownloadView類執行的方法:
DownloadTableView *download = [[DownloadTableView alloc] init];
[download queueAndStartDownloads:_downloadURL];
這條線犯規設置委託權
self.downloadManager = [[DownloadManager alloc] initWithDelegate:self];
整開始下載方法
- (void)queueAndStartDownloads:(NSURL *)url
{
NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
NSString *downloadFolder = [documentsPath stringByAppendingPathComponent:@"downloads"];
if ([[NSFileManager defaultManager] fileExistsAtPath:downloadFolder]) //Does file exist?
{
if (![[NSFileManager defaultManager] createDirectoryAtPath:downloadFolder
withIntermediateDirectories:NO
attributes:nil
error:nil]) {
}
}
self.downloadManager = [[DownloadManager alloc] initWithDelegate:self];
self.downloadManager.maxConcurrentDownloads = 4;
NSString *downloadFilename = [downloadFolder stringByAppendingPathComponent:[url lastPathComponent]];
[self.downloadManager addDownloadWithFilename:downloadFilename URL:url];
self.cancelButton.enabled = YES;
self.startDate = [NSDate date];
NSLog(@"DOwnling");
[self.downloadManager start];
}
我DownloadView類中的方法不會執行
- (void)didFinishLoadingAllForManager:(DownloadManager *)downloadManager
{
你還沒有顯示足夠的代碼來查明問題。但通常不要做一個「initWithDelegate」方法,它不是通常的做事方式。爲您的類(或子類)使用指定的初始化程序並在此之後分配委託。 –
我正在使用這個傢伙下載管理器https://github.com/robertmryan/download-manager – nickivey
如果需要委託,那麼我看到指定的初始化程序initWithDelegate沒有錯。 – CrimsonChris