Возможный дубликат:
Загрузить PDF-файл из каталога документов - iPhone
Я пытаюсь создать PDF-файл из файла, который я сохранил в каталоге документов (1.pdf). Вот мой код:
// Get Documents Directory
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [searchPaths objectAtIndex:0];
NSString *tempPath = [documentsDirectoryPath stringByAppendingPathComponent:[appDelegate.issueToLoad stringByAppendingPathExtension:@"pdf"]];
NSString *path = [tempPath stringByReplacingOccurrencesOfString:@"localhost/" withString:@""];
NSLog(@"PATH: %@", path);
//Display PDF
pdf = CGPDFDocumentCreateWithURL((CFURLRef)[NSURL fileURLWithPath:path]);
NSLog(@"PDF: %@", pdf);
Первый NSLog создает ссылку на файл:
/ Users / myname / Library / Application Support / iPhone Simulator / 3.2 / Applications / 9C2047A6-DDD2-418F-A329-4EE6E4647770 / Documents / 1.pdf
Однако второй NSlog производит:
(НУЛЕВОЙ)
Что-то не так с моим кодом?
Спасибо