Re: CGContextConcatCTM: invalid context 0x0. How to fix?
Re: CGContextConcatCTM: invalid context 0x0. How to fix?
- Subject: Re: CGContextConcatCTM: invalid context 0x0. How to fix?
- From: Dean Reyburn <email@hidden>
- Date: Thu, 19 Sep 2013 10:58:58 -0400
I ran into this yesterday converting CoreFoundation to ObjC with XCode 5. The old CF call to CGContextDrawImage(context, rect, picname) did not throw anything into the console.
But when I replaced CGContextDrawImage() with a call to the UIImage method: [picname drawInRect:rect]; then I got:
CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
I was not calling CGContextRestoreGState() at all, at least not explicitly.
I fixed this by pushing and popping the context:
UIGraphicsPushContext(context);
[picname drawInRect:rect]; // picname here is a UIImage *
UIGraphicsPopContext();
So it would seem that some ObjC objects such as UIImage are implemented with CF code under the skin.
Hope that helps,
-Dean
On Sep 19, 2013, at 3:31 AM, Gerriet M. Denkmann <email@hidden> wrote:
>> This is more a Cocoa question than an Xcode question, but here goes:
>>
>> The value of the first parameter to these functions are NULL. In the documentation, this parameter is called "CGContextRef c".
>> So make sure "c" is not NULL (and has a valid value).
>
> The problem: Xcode tells me I am nowhere using any of these functions. So what to do next?
>
> Gerriet.
1-888-SOFT-440 or 1-888-763-8440
Reyburn Piano Service, Inc.
http://www.reyburn.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden