How to detect where NaN is passing to CoreGraphics API on Mac OS X 10.9

After much digging around, I've found you can set a symbolic breakpoint on "CGPostError" in Xcode, and that will give you a stack trace.


The habit of creating lazy UIView's with a .zero frame played against me when doing it for a PDFView.

This

var pdfView = PDFView(frame: .zero)

will generate lots of the same logs from the question. The reason I used .zero, is because later I set up the view with constraints. This proved to be a problem. The solution was to use an arbitrary, non-zero frame when initializing the PDFView.

var pdfView = PDFView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

I was getting this error when I was foolishly retaining an NSPopover for future use.

It seems popover.showRelativeToRect(_:) is all you need to do, and then you can forget about it.