Got the following error:
CGDataConsumerCreateWithFilename: failed to open `/name' for writing: Permission denied.
With this code (not mine):
- (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();
}
So: Where should I store this PDF-File? I tried the NSBundle MainBundle
thing and it did not work either.
Thank you!