Edit AllPages


I am currently learning Cocoa as I am porting my Win32 App across to Mac. Although most of the concept have been fairly simple to port across, from time to time I come across something which confuses me no end!

Drag and drop with NSOutlineView is one such problem…

I have found and looked at the example that comes with XCode, but I believe that the tutorial is too complex to answer the simple question of exactly how, step by step, to allow drag and drop. So, I am writing my own SIMPLE tutorial. However, I need some help…

The tutorial consists of 2 outlineviews on a window, each of which is controlled by it’s own controller. I have created a custom class (OlvNode) and I want to be able to drag OlvNode objects from the left OutlineView to the right out lineView. Simple. Right? Well, I’ve hit some snags.

In the controller for the source outlineview, I have the following code:

Then for the receiving outlineview, I call the following code:

The problem I’m having is that when I’m dragging the node over, the app crashes, and I don’t know why. I’d REALLY appreciate any help in this!!!

I’ll happily email the source to anyone who wants to see for themselves - email me at to let me know you want it.

Thanks in advance!!!!!!!!!!!!!

Posting your code and stating your application crashes doesn’t really help; you’re missing a vital piece of information. Where does it crash? :-) Run your application in the debugger and tell us what line kills it. To learn how to do this, see DebuggingTechniques, specifically the “Breaking on Exceptions” section. This technique more often than not will show you exactly what’s wrong.