kCGErrorFailure while performing drag and drop in NSView
I have created a simple drag and drop application in which I am sometimes getting this exception msg, displayed in debugger console:
kCGErrorRangeCheck: CGSNewWindowWithOpaqueShape: Cannot create window
kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
kCGErrorIllegalArgument: CGSMoveWindow: Invalid window 0x0
kCGErrorIllegalArgument: CGSOrderWindowList
kCGErrorIllegalArgument: CGSOrderWindowList
kCGErrorIllegalArgument: CGSGetWindowBounds: NULL window
kCGErrorIllegalArgument: CGSMoveWindow: Invalid window 0x0
kCGErrorIllegalArgument: CGSOrderWindowList
kCGErrorIllegalArgument: CGSGetWindowBounds: NULL window
Can anyone suggest me why is it occurring and how can 开发者_C百科I resolve it?
Also can anyone suggest how to set breakpoint for @CGErrorBreakpoint() so that I can debug and trace its cause?
The code in concludeDragOperation is:
NSPoint dropLocation = [sender draggedImageLocation];
id dragSource = [sender draggingSource];
NSPasteboard *pb = [sender draggingPasteboard];
NSData *draggedData = [pb dataForType:IconDragDataType];
id unarchievedObject = [NSKeyedUnarchiver unarchiveObjectWithData:draggedData];
[unarchievedObject setFrameOrigin:dropLocation];
Thanks,
Miraaj
To set a breakpoint in CGErrorBreakpoint open the breakpoints window (command-option-B), double-click on the line that says "Double-Click for Symbol" and enter CGErrorBreakpoint in the text field.
精彩评论