self.pdfPath = [[NSBundle mainBundle] pathForResource:@"iPhone_SDK_License" ofType:@"pdf"];
NSData *htmlData = [NSData dataWithContentsOfFile:pdfPath];
NSString *htmlstr = [[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding];
它在htmlstr中显示为nil,因此需要一些帮助。
答案 0 :(得分:0)
pdf不是一个html文件,所以我假设initWithData:encoding:无法理解数据,因此失败。
使用stringWithContentsOfURL:encoding:error:查看错误的详细信息。