[swift-users] Debugger woes

Maury Markowitz maury.markowitz at gmail.com
Tue Jan 31 12:54:14 CST 2017


I hope this is the right place to ask this:

I'm using Xcode Version 8.2.1 (8C1002) and I'm trying to find out what's going wrong in my Swift3 app. Here's the code:

		let background = sceneView.snapshot().cgImage!
		let cropped = background.cropping(to: overlayView.frame)
		UIGraphicsBeginImageContextWithOptions(overlayView.frame.size, false, 1.0)

I have a breakpoint on the first line. When it trips I F6 to the next line and examine background:

(lldb) p background
(CGImage) $R0 = 0x00000001741d4370 {}
Printing description of background:
<CGImage 0x1741d4370>
	<<CGColorSpace 0x170024480> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)>
		width = 640, height = 998, bpc = 8, bpp = 32, row bytes = 2560 

Now I hit F6 again and do the same thing:

(lldb) p background
error: <EXPR>:3:1: error: use of unresolved identifier 'background'
background
^~~~~~~~~~

This happens to pretty much every variable in the app, after running another line or two, it apparently disappears. This is particularly annoying in this case, because QuickLook fails almost every time, which makes debugging image work somewhat difficult.

I've cleaned and rebooted and it keeps coming back. Any suggestions?


More information about the swift-users mailing list