while loading pdf at VFR Reader get error in ios

2019-08-05 18:25发布

问题:

Its not working because I am not using ARC in project and here is my code

While download and saving pdf

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *comicbook_id = [[NSUserDefaults standardUserDefaults]stringForKey:@"comicbook_id"];
NSString *filePath = [NSString stringWithFormat:@"%@/book_%@.pdf", documentsDirectory,comicbook_id];

While retreiving to my reader I proceed

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *comicbook_id = [[NSUserDefaults standardUserDefaults]stringForKey:@"comicbook_id"]; 
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"book_%@.pdf",comicbook_id]];

NSLog(@"date==>%@",documentsDirectory);
NSString *phrase = nil;
ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:phrase];
NSLog(@"document==>%@",document);
if (document != nil) {
   ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
   readerViewController.delegate = self;
   readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
   readerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
   [self presentViewController:readerViewController animated:YES completion:nil];
}