NSURL *urlTopdf = [NSURL URLWithString:appDelegate.pdfString];NSLog(@"AD: %@",appDelegate.pdfString);NSLog(@"pdf: %@",urlTopdf);pdf = CGpdfdocumentCreateWithURL((CFURLRef)urlTopdf);
这是日志:
2012-03-20 18:31:49.074 The Record[1496:15503] AD: /Users/John/library/Application Support/iPhone Simulator/5.1/Applications/E1F20602-0658-464D-8DDC-52A842CD8146/documents/issues/3.1.12/march 1,2012.pdf2012-03-20 18:31:49.074 The Record[1496:15503] pdf: (null)
我认为问题的一部分可能是Nsstring包含斜杠/和破折号 – .我做错了什么?谢谢.
解决方法 为什么不以这种方式创建文件路径.Nsstring *filePath = [[NSBundle mainBundle]pathForResource:@"pdfname" ofType:@"pdf"];
然后使用这样的文件路径创建您的URL.
NSURL *url = [NSURL fileURLWithPath:filePath];总结
以上是内存溢出为你收集整理的iphone – NSString不会转换为NSURL(NSURL为null)全部内容,希望文章能够帮你解决iphone – NSString不会转换为NSURL(NSURL为null)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)