NSArray Controller

Discussion in 'Mac Programming' started by liptonlover, Jun 2, 2008.

  1. liptonlover macrumors 6502a

    Mar 13, 2008
    for learning experience I'm trying to work with arrays. I know how an array works, I have plenty of background with arrays. But NSArrays and MutableArrays are killing me. I create a new project, a regular cocoa one. I make an NSTableView with one column, a button to add to it, and a button to remove from it. I create an NSArrayController, and link it up with the tableview and the buttons, using the built in Array Controller class. But when I try compiling, after properly incorporating the class into my project, I get around 50 errors, saying that my class is incomplete and it lists all these methods that for some reason the class is deciding not to add to itself. When the class was added to the project I saw that it only had three methods. What's wrong? Can someone please either explain how to do it, or simply send via email a project with a tableview, the two buttons and an array, all appropriately linked so I can view it and learn from it? My email address is lipton_lover@mac.com
  2. gnasher729 macrumors P6


    Nov 25, 2005
    That would be rather pointless, because tomorrow you run into another problem. What you need to learn is how to fix it yourself.

    Ignore all of the errors except the first one. Check where in the source code the error occurs. At that point, there is disagreement between what _you_ think your code does and what the compiler thinks. That's the point you need to find and fix.

    One hint: Very often just a missing brace ( { } ) is enough to confuse everything completely. When you double-click on a parenthesis or a curly brace the editor will select everything up to the matching closing parenthesis. Check whether it is where you think it should be. That very often solves the problem. If nothing gets selected, a bracket is missing. Double click on the bracket at the end, and the editor will show you where the matching opening bracket is.
  3. liptonlover thread starter macrumors 6502a

    Mar 13, 2008
    thanks, but I can't have made a mistake because I haven't written any code. It was all done in IB.
  4. crees! macrumors 68000


    Jun 14, 2003
    That could be then because NSArrayController is looking for some required functions that you didn't supply. What are those called.. formal protocols. I'm just learning this stuff so I might not be on the mark.

Share This Page