Получена следующая ошибка:
CGDataConsumerCreateWithFilename: failed to open `/name' for writing: Permission denied.
С этим кодом (не моим):
- (void)createPDFWithName
{
//NSURL * newFilePath = [[NSURL alloc] initFileURLWithPath:name];
NSString * newFilePath = @"name";
CGRect page = CGRectMake(0, 0, 300, 300);
NSDictionary * metaData = nil;
if (!UIGraphicsBeginPDFContextToFile(newFilePath, page, metaData )) {
NSLog(@"error creating PDF context");
return;
}
UIGraphicsBeginPDFPage();
[self.tableView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndPDFContext();
}
Итак: где я должен хранить этот PDF-файл? Я попробовал вещь NSBundle MainBundle
, и она тоже не сработала.
Спасибо!