我的应用程序允许将 PDF 下载到设备。但是,在下载 PDF 时,该应用程序在下载完成之前无法执行任何操作。我该怎么做才能在下载过程中处理其他操作?这是我到目前为止下载的内容。
RSSEntry *entry = [_allEntries objectAtIndex:indexPath.row];
NSString *urlString = entry.articlePDF;
NSURL *url = [NSURL URLWithString:urlString];
NSData *data = [NSData dataWithContentsOfURL:url];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filename = [entry.articleTitle stringByAppendingString:@".pdf"];
NSString *removed = [filename stringByReplacingOccurrencesOfString:@"/" withString:@""];
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent: removed];
NSLog(@"Downloadstarted%@", pdfPath);
[data writeToFile:pdfPath atomically:YES];