これが無効なコンテキストを報告するのはなぜですか?
<Error>: CGContextSaveGState: 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.
これは、drawInRect
UIImage のカテゴリ メソッドでの呼び出しで発生します。
- (UIImage *)myImagePaddedToSize:(CGSize)newSize {
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
CGSize oldSize = self.size;
CGRect rect = (CGRect){
{
floorf((newSize.width-oldSize.width)/2),
floorf((newSize.height-oldSize.height)/2)
},
oldSize
};
[self drawInRect:rect];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
私の理解では、UIGraphicsBeginImageContextWithOptions
それが私が引き込むコンテキストを確立するということです。そして、これは通常、ケアのようですが、代わりにこの失敗をすることはめったにありません。
これは、Xcode 5.1.1 に含まれる iOS 7 シミュレーターを使用しています。