找不到pdf标题:找不到%pdf.
我想知道为什么在控制台窗口中触发此错误?为什么它提到了与pdf相关的东西,虽然我没有在整个项目中使用任何pdf相关的东西.
用于打印屏幕截图的代码是:
- (IBAction)print:(ID)sender { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) UIGraphicsBeginImageContextWithOptions(self.vIEw.bounds.size,NO,[UIScreen mainScreen].scale); else UIGraphicsBeginImageContext(self.vIEw.bounds.size); [self.vIEw.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *vIEwImage = UIGraphicsGetimageFromCurrentimageContext(); UIGraphicsEndImageContext(); //saving the file to documents directory NSData * imageData = UIImagePNGRepresentation(vIEwImage); NSArray *paths = NSSearchPathForDirectorIEsInDomains(NSdocumentDirectory,NSUserDomainMask,YES); Nsstring *documentsDirectory = [paths objectAtIndex:0]; documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Screenshot.png"]; [imageData writetofile:documentsDirectory atomically:YES]; Nsstring *myfilePath = [documentsDirectory stringByAppendingPathComponent:@"Screenshot.png"]; UIImage *screenShot = [UIImage imageWithData:imageData]; NSData *myData = [NSData dataWithData:UIImagePNGRepresentation(screenShot)]; self.pic = [UIPrintInteractionController sharedPrintController]; if (self.pic && [UIPrintInteractionController canPrintData:myData] ) { self.pic.delegate = self; //filling up print info uiprintinfo *printInfo = [uiprintinfo printInfo]; printInfo.outputType = uiprintinfoOutputGeneral; printInfo.jobname = [myfilePath lastPathComponent]; printInfo.duplex = uiprintinfoDuplexLongEdge; self.pic.printInfo = printInfo; self.pic.showsPageRange = YES; self.pic.printingItem = myData; voID (^completionHandler)(UIPrintInteractionController *,BOol,NSError *) = ^(UIPrintInteractionController *pic,BOol completed,NSError *error) { if (!completed && error) NSLog(@"Failed! due to error in domain %@ with error code %u",error.domain,error.code); }; [self.pic presentFromrect:self.printbutton.frame inVIEw:self.vIEw animated:YES completionHandler: completionHandler]; // iPad } }
文件路径(Screenshot.png)是正确的,并且它已正确保存到文档目录.
解决方法 这将有助于知道哪条线确切地导致控制台输出.您可以在调试器中单步执行以查找.我的猜测是调用 – [UIPrintInteractionController canPrintData:].如果您阅读the documentation for that method,您将看到它必须检查该数据是否包含pdf.它看起来像尝试和失败,沿途打印一条消息.
由于一般没有最终用户观看iOS控制台,这不是一个非常重要的错误,显然对Apple来说不够重要.
总结以上是内存溢出为你收集整理的iphone – 控制台错误:找不到PDF标题:找不到`%PDF’全部内容,希望文章能够帮你解决iphone – 控制台错误:找不到PDF标题:找不到`%PDF’所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)