+2  A: 
James Williams
I had a similar thought before I submitted this to SO and tried [@"String 1" copy] to see what would happen. That didn't make any difference either, but likely Cocoa is doing something special with static strings that might cause them to always have the same address since they are truly immutable (I didn't test that yet, though). This does seem like a strange limitation and I wonder if it's NSCollectionView or the NSArrayController that's really at fault.
Sean
Yep. It's got to be the duplicate objects thing. (Specifically, object instances with the same address.) I decided to try forcing it to create new strings every time and the easiest way I could think of was to turn the static strings into NSMutableStrings. That made it work. (The question now is, is this a bug or by design?) Like so: [controller addObjects:[NSArray arrayWithObjects:[NSMutableString stringWithString:@"String 1"],[NSMutableString stringWithString:@"String 2"],[NSMutableString stringWithString:@"String 3"],nil]];
Sean
+2  A: 

Assigning the exact same immutable string to the address is by design. It is a performance optimization.

A different way to accomplish your goal would be:

NSString* param1 = [NSString stringWithFormat:@"string1"];
NSString* param2 = [NSString stringWithFormat:@"string2"];
NSString* param3 = [NSString stringWithFormat:@"string3"];

[controller addObjects:[NSArray arrayWithObjects:param1,param2,param3,nil]];

[param1 release];
[param2 release];
[param3 release];

edit: Just using the stringWithFormat is sufficent it turns out

[controller addObjects:[NSArray arrayWithObjects:[NSString stringWithFormat:@"string1"],
                                                 [NSString stringWithFormat:@"string2"],
                                                 [NSString stringWithFormat:@"string3"],nil]];
ACBurk
+2  A: 

I wouldn't call this type of limitation a bug. A data driven view typically expects to use the content objects as keys. For example, in NSOutlineView you have these two methods:

– itemAtRow:
– rowForItem:

Where item is some arbitrary object either supplied via bindings, or through the data source mechanism. If the objects in the outline view aren't unique, how is NSOutlineView supposed to reliably implement rowForItem:? If the same object appeared N times in the outline view, there would be N rows for it.

NSCollectionView doesn't seem to have an interface that precludes multiple instances of the same content object, but I think this expectation is typical of data driven views.

You should use unique content objects.

Jon Hess
A: 

I have a question about your toy program - you have buttons in your NSViewItem - did you get them to actually do anything? Could you kindly share on how did you manage them to work is you did - what/how you connected/bound those buttons, etc.

Thank you very much for the response :)

A.T.