Cocoa Help Request: Scrolling issue with NSTableView?

in Genius Bar edited January 2014
I gather that a few of you guys are Cocoa guys, I've just gotten started after programming in Java for a year and I've run into a problem I just can't fix.

The program is basic, it takes in the name, artist and album of all of the items in the iTunes library (using applescript) and creates a song object, each holding the name, artist and album information and adds them to the global mutable array "songs". This appears to run fine.

A table view then displays the list (as iTunes does). On loading the application runs fine and the log shows each song in the library is getting added to the array. However when I try to scroll down the table view, it crashes, sometimes the songs below the ones originally displayed are partially shown, sometimes not.

The debugger stopped at objc_msgSend_rtp thread(?) and breaks on this line:


0xfffeff20 <+0032> lwz r11,0(r2)

I've done just a little bit of low-level programming at university in the for of SPIM, but I guess this isn't SPIM, so I'm not too sure what it means.

If anyone's got any ideas what I might be doing wrong, I'd be most grateful. I'm still young in the world of programming, especially Cocoa.


  • Reply 1 of 2
    MarvinMarvin Posts: 14,213moderator
    That line of low-level code ain't gonna help much. They basically just tell you what is happening with the registers.

    It would be far easier for you to post the offending Obj-C code.

    Are they actually teaching Cocoa or did you choose it for a project? I'm guessing Junior Honours? I did Java in second year.

    I used Cocoa by choice in 4th year but I didn't like it and I haven't used it since so I might not be able to help much. But if you post the code then there are folks round here who will get it sorted.
  • Reply 2 of 2
    lundylundy Posts: 4,466member
    Yeah, are you running this in Xcode? Source debugging would be the thing I would do. Build and Debug. Although I guess that it is crashing in a Cocoa framework, for which you do not have source... but that would lead me to look at the data, try smaller subsets of the data, etc. - if it is working until you scroll, then I think corrupt data is more likely than a bug in the Cocoa list view scrolling code. You might even have to look at the AppleScript data with a hex editor, or skip that part altogether and make some fake data in a separate Cocoa routine to fill the array. At least then you know the data is OK.

    I would also not discount the possibility that the AppleScript data might have some crazy terminating characters. I have seen this many times.
Sign In or Register to comment.