[英]Why am I getting this error involving `_kFIRLoggerInstanceID`?
[英]why am i getting this error with cgcontext
我收到此错误,通常是当我长按uitextfield并出现放大镜时,同时报告了许多此类错误
例如:CGContextSetStrokeColorWithColor:无效的上下文0x0。 这是一个严重的错误。 此应用程序或其使用的库正在使用无效的上下文,从而导致系统稳定性和可靠性整体下降。 此通知是礼貌的:请解决此问题。 在即将进行的更新中,它将成为致命错误。
我唯一的绘图代码如下
此代码有什么问题
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext(); //context
CGContextBeginPath (context);
CGContextSetLineWidth(context,3);
CGPoint center = CGPointMake(rect.size.width / 2, rect.size.height / 2);//get the view centre
//get the polygon points
CGContextMoveToPoint(context, center.x-70,rect.size.height - 140 );
CGContextAddLineToPoint(context, center.x + 130, rect.size.height - 140);
CGContextAddLineToPoint(context, center.x - 70, 100);
CGContextAddLineToPoint(context, center.x- 70, rect.size.height - 140);
CGContextAddLineToPoint(context, center.x - 50, rect.size.height -140);
CGContextAddLineToPoint(context, center.x - 50, rect.size.height - 160);
CGContextAddLineToPoint(context, center.x - 70, rect.size.height - 160);
CGContextClosePath(context);//close the path
//[[UIColor clearColor] setFill];//set the colour for fill
[[UIColor blackColor] setStroke];//set the line color
CGContextDrawPath (context, kCGPathStroke);//draw
}
您是调用drawRect:
方法的人吗? 您不应该这样做,应该调用setNeedsDisplay
,并且应用程序将在适当的时候调用drawRect:
如果您自己调用drawRect:
方法,则不会将CGContext推送到上下文堆栈,因此UIGraphicsGetCurrentContext()
将返回nil
,并且您会看到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.