LoginSignup
64
60

More than 5 years have passed since last update.

invalid contextの場所を特定する

Posted at

: CGContextSaveGState: invalid context 0x0
: CGContextSetCompositeOperation: invalid context 0x0
: CGContextFillRects: invalid context 0x0
: CGContextRestoreGState: invalid context 0x0
: CGContextSetBlendMode: invalid context 0x0
: CGContextDrawImage: invalid context 0x0
: CGBitmapContextCreateImage: invalid context 0x0
: CGContextSaveGState: invalid context 0x0
: CGContextSetCompositeOperation: invalid context 0x0
: CGContextFillRects: invalid context 0x0
: CGContextRestoreGState: invalid context 0x0
: CGContextSetBlendMode: invalid context 0x0
: CGContextSetInterpolationQuality: invalid context 0x0
: CGContextDrawImage: invalid context 0x0
・・・
とずら〜とでてきて、その場所が特定できずに途方に暮れた経験はありませんか?
私はあります。

どうやらこれはブレークポイントを仕掛けることが可能のようです。
xCode左のナビゲーションエディタを、ブレークポイントのタブに切り替えて、
左下の+ボタンを押して、add symbolic breakpointを選びます
そしてSymbolに、CGPostErrorと入力してdone.
これだけです。

あと実行すればきっとエラー個所でブレークします。

今回の例では、
あとはpoデバッガコマンドを使って、コンテキストのwidth,heightを調べたら0になってましたとさ。めでたしめでたし。

64
60
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
60