ios应用程序Objective-c创建的巨大PDF大小(在真实设备上)

ios应用程序Objective-c创建的巨大PDF大小(在真实设备上),ios,objective-c,pdf,uiscrollview,simulator,Ios,Objective C,Pdf,Uiscrollview,Simulator,目前在我的ios应用程序中,我正在从UIScrollView创建pdf。在模拟器上创建pdf时,文件大小约为1.5个月。但在真实设备(iPad)上创建pdf时,文件大小约为75个月 有人知道我为什么会遇到这个问题吗 编辑1 这个问题似乎出现在iOS>=10.3上的每个设备(模拟器或real)上。但在iOS=8.3上,pdf大小没有问题 编辑2 我发现问题可能与UILabel有关。当我对添加到scrollview的UILabel进行注释时,pdf大小是正常的。当我取消对UILabel的注释时,pd

目前在我的ios应用程序中,我正在从UIScrollView创建pdf。在模拟器上创建pdf时,文件大小约为1.5个月。但在真实设备(iPad)上创建pdf时,文件大小约为75个月

有人知道我为什么会遇到这个问题吗

编辑1

这个问题似乎出现在iOS>=10.3上的每个设备(模拟器或real)上。但在iOS=8.3上,pdf大小没有问题

编辑2

我发现问题可能与UILabel有关。当我对添加到scrollview的UILabel进行注释时,pdf大小是正常的。当我取消对UILabel的注释时,pdf的大小变得巨大

以下是我创建PDF的代码:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *directroyPath = nil;
directroyPath = [documentsDirectory stringByAppendingPathComponent:@"PDF"];
NSString *filePath = [directroyPath stringByAppendingPathComponent:@"test.pdf"];



NSError *error;
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {

} else {
  [[NSFileManager defaultManager] createDirectoryAtPath:directroyPath
                          withIntermediateDirectories:NO
                                           attributes:nil
                                                error:&error];

}

CGContextRef pdfContext = [self createPDFContext:myScrollView.bounds path:(CFStringRef)filePath];

CGFloat height = 1056;

for (int i = 0 ; i< nbPage ; i++) {
  CGContextBeginPage (pdfContext,nil);

  //turn PDF upsidedown
  CGAffineTransform transform = CGAffineTransformIdentity;
  transform = CGAffineTransformMakeTranslation(0, (i+1) * height);
  transform = CGAffineTransformScale(transform, 1.0, -1.0);
  CGContextConcatCTM(pdfContext, transform);

  //Draw view into PDF
  [myScrollView.layer renderInContext:pdfContext];
  CGContextEndPage (pdfContext);
  [myScrollView setContentOffset:CGPointMake(0, (i+1) * height) animated:NO];
}
CGContextRelease (pdfContext);

unsigned long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil] fileSize];
NSLog(@"FileSize: %llu", fileSize);

}
NSArray*path=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString*documentsDirectory=[paths objectAtIndex:0];
NSString*directroyPath=nil;
directroyPath=[DocumentsDirectoryStringByAppendingPathComponent:@“PDF”];
NSString*filePath=[directroyPath stringByAppendingPathComponent:@“test.pdf”];
n错误*错误;
if([[NSFileManager defaultManager]fileExistsAtPath:filePath]){
}否则{
[[NSFileManager defaultManager]创建目录路径:directroyPath
中间目录:否
属性:无
错误:&错误];
}
CGContextRef pdfContext=[self-createPDFContext:myScrollView.bounds路径:(CFStringRef)文件路径];
CGFloat高度=1056;
对于(int i=0;i
谢谢,