Im travaillant sur un projet et ma classe UIWebView doit exécuter une méthode de ma classe DownloadViewdélégué ne pas être correctement réglé
J'utilise le projet open source https://github.com/robertmryan/download-manager
Lorsque ce code exécute la méthode:
DownloadTableView *download = [[DownloadTableView alloc] init];
[download queueAndStartDownloads:_downloadURL];
Ce ne marche pas en ligne droite définie le délégué
self.downloadManager = [[DownloadManager alloc] initWithDelegate:self];
La méthode de téléchargement entier début
- (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];
}
Les méthodes dans ma classe DownloadView exécutent wont
- (void)didFinishLoadingAllForManager:(DownloadManager *)downloadManager
{
Vous n'avez pas montré suffisamment de code pour pouvoir identifier le problème. Mais en général, ne faites pas une méthode "initWithDelegate", ce n'est pas la manière habituelle de faire les choses. Utilisez l'initialiseur désigné pour votre classe (ou sous-classe) et attribuez le délégué après cela. –
Im utilisant ce gestionnaire de téléchargement gars https://github.com/robertmryan/download-manager – nickivey
Si un délégué est requis, je ne vois rien de mal avec l'initialiseur désigné étant initWithDelegate. – CrimsonChris