Вот этот код. Он загружает уменьшенное изображение, а затем пытается создать изображение на основе пути к файлу эскиза. Но это дает мне ошибку EXC_BAD_ACCESS при вызове метода «imageWithContentsOfFile». В то время как EXC_BAD_ACCESS обращается к коду, пытающемуся получить доступ к выпущенному объекту, скорее всего, я не знаю, какой объект он может быть. Любая помощь будет оценена!iOS [UIImage imageWithContentsOfFile: filePath] Выпуск EXC_BAD_ACCESS
NSBlockOperation *completionOperation = [NSBlockOperation blockOperationWithBlock:^{
if([[NSFileManager defaultManager] fileExistsAtPath:operation.destinationPath ]){
NSString *key = [[MEURLCacheKeyRegister sharedRegister] cacheKeyForURL:operation.fileUrl];
UIImage *image = [UIImage imageWithContentsOfFile:operation.destinationPath];
}else{
DDLogDebug(@"Thumbnail file doesn't exist at %@", operation.destinationPath);
}
}
}];
AFDownloadRequestOperation *requestOperation = [FileServerDownloadUtils downloadOperationForURL:operation.fileUrl
destinationPath:operation.destinationPath
completion:completionOperation];
[self.fileSyncQueue addOperation:requestOperation];
Какую строку он сбрасывает и что вы делаете с переменной 'image' после загрузки в блок завершения? – Abhinav
Привет, Абхинав, он разбился по строке UIImage * image = [UIImage imageWithContentsOfFile: operation.destinationPath]; – user744641
Операция - это пользовательский объект NSOperation BTW. – user744641