Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
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
Thanks!
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
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?

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.
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
thanks, but I can't have made a mistake because I haven't written any code. It was all done in IB.
 

crees!

macrumors 68020
Jun 14, 2003
2,018
245
MD/VA/DC
thanks, but I can't have made a mistake because I haven't written any code. It was all done in IB.

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.