while loading pdf at VFR Reader get error in ios

2019-08-05 18:35发布

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];
}

0条回答
登录 后发表回答