Ios UIGraphicsGetImageFromCurrentImageContext()使iPad 3上的应用程序崩溃

Ios UIGraphicsGetImageFromCurrentImageContext()使iPad 3上的应用程序崩溃,ios,objective-c,ipad,uiimageview,uiimage,Ios,Objective C,Ipad,Uiimageview,Uiimage,我的问题是,当我多次将UIGraphicsGetImageFromCurrentImageContext()返回的图像分配给UIImageView时,我的应用程序崩溃。这是我的代码:如果省略UIImageView应用程序的赋值行,它将不会崩溃 UIImage * newImage3; UIGraphicsBeginImageContext(duplicateImage.size); [duplicateImage drawAtPoint:CGPointM

我的问题是,当我多次将UIGraphicsGetImageFromCurrentImageContext()返回的图像分配给UIImageView时,我的应用程序崩溃。这是我的代码:如果省略UIImageView应用程序的赋值行,它将不会崩溃

 UIImage *   newImage3;  
   UIGraphicsBeginImageContext(duplicateImage.size);

            [duplicateImage drawAtPoint:CGPointMake(0, 0)];


            context2=UIGraphicsGetCurrentContext();

            for(int k=0; k<kmtaGroup->TotalLines; k++)
            {
                lineObject=&kmtaGroup->Line_INFO_OBJ[k];
                x0 = lineObject->x0;
                y0= lineObject->y0;
                x1= lineObject->x1;
                y1= lineObject->y1;
                color= lineObject->Color;
                lineWidth= lineObject->LinkWidth;

                lineColor=[self add_colorWithRGBAHexValue:color];
                linearColor=lineColor;

                // Brush width
                CGContextSetLineWidth(context2, lineWidth);
                // Line Color
                CGContextSetStrokeColorWithColor(context2,[linearColor CGColor]);


                CGContextMoveToPoint(context2, x0, y0);

                CGContextAddLineToPoint(context2, x1, y1);
                CGContextStrokePath(context2);


            }



             newImage3=UIGraphicsGetImageFromCurrentImageContext();

        }

              imageView.image=newImage3;

             UIGraphicsEndImageContext();
UIImage*newImage3;
UIGraphicsBeginImageContext(duplicateImage.size);
[duplicateImage drawAtPoint:CGPointMake(0,0)];
context2=UIGraphicsGetCurrentContext();
对于(int k=0;k总直线;k++)
{
lineObject=&kmtaGroup->Line_INFO_OBJ[k];
x0=线对象->x0;
y0=线条对象->y0;
x1=lineObject->x1;
y1=线条对象->y1;
颜色=线条对象->颜色;
lineWidth=lineObject->LinkWidth;
lineColor=[使用RGBAhexValue:color自添加颜色];
linearColor=lineColor;
//刷子宽度
CGContextSetLineWidth(context2,线宽);
//线条颜色
CGContextSetStrokeColorWithColor(context2[linearColor CGColor]);
CGContextMoveToPoint(context2,x0,y0);
CGContextAddLineToPoint(context2,x1,y1);
CGContextStrokePath(context2);
}
newImage3=UIGraphicsGetImageFromCurrentImageContext();
}
image=newImage3;
UIGraphicsSendImageContext();

请共享代码好吗?在iPad3上运行的操作系统版本请发布您的代码并崩溃logs@Jageen发布了代码。@SeanSense如何获取崩溃日志并在此处发布?@Jageen,我注意到一件事,即如果我延迟几秒钟执行此任务,则应用程序不会立即崩溃,尽管它会反复发出内存警告