【发布时间】:2012-01-20 02:12:11
【问题描述】:
得到以下错误:
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 的东西,它也不起作用。
谢谢!
【问题讨论】: