I am trying to get @distinctUnionOfArrays to work with bindings.

I have a Master NSArrayController. This contains an array of
NSMutableDictionary objects. Each Dictionary has three NSString keys/fields:
Genre, Artist, Album.

I set the content of the Master Controller to my NSMutableArray and all is
well - the array shows up in an NSTableView.

I then have a single-column TableView "Genre" I have Genre NSArrayController
and I try to bind this array controller to the Master Controler with IB:

Genre, bound to Master

Controller key: arrangedObjects
Model Key Path: @distinctUnionofArrays.Genre

My goal is to get a list of all the Genres in the Master array with no
duplicates... But I get a crash:

abort() called
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[NSCFString count]: unrecognized selector sent to instance
0x10045cc20'
*** Call stack at first throw:
(
    0   CoreFoundation                     0x00007fff86827444
__exceptionPreprocess + 180

    1   libobjc.A.dylib                     0x00007fff818b00f3
objc_exception_throw + 45

    2   CoreFoundation                      0x00007fff868801c0
+[NSObject(NSObject) doesNotRecognizeSelector:] + 0

    3   CoreFoundation                      0x00007fff867fa08f
___forwarding___ + 751

    4   CoreFoundation                      0x00007fff867f61d8
_CF_forwarding_prep_0 + 232

    5   CoreFoundation                      0x00007fff867d3a47
-[NSMutableArray addObjectsFromArray:] + 71

    6   Foundation                          0x00007fff859fdba4
-[NSArray(NSKeyValueCoding) _unionOfArraysForKeyPath:] + 112

    7   Foundation                          0x00007fff859fda74
-[NSArray(NSKeyValueCoding) _distinctUnionOfArraysForKeyPath:] + 28

    8   Foundation                          0x00007fff8598d4d7
-[NSArray(NSKeyValueCoding) valueForKeyPath:] + 566

    9   Foundation                          0x00007fff85930db6
-[NSObject(NSKeyValueCoding) valueForKeyPath:] + 376


Any ideas?

I tired binding in code (rather than IB) and while I made sure to bind Genre
to Master after Master already had it setContent,  got the same result.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to