NSArrayController - error inserting object at arranged object index N
NSArrayController - error inserting object at arranged object index N
- Subject: NSArrayController - error inserting object at arranged object index N
- From: Jonathan Mitchell <email@hidden>
- Date: Thu, 23 Jun 2016 14:27:04 +0100
The following raises with NSInternalInconsistencyException when :
1. an NSArrayController filter is in place,
2. controller.clearsFilterPredicateOnInsertion = NO
3. added content object is rejected by the filter.
Is this behaviour by design?
#import “AppDelegate.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSArrayController *controller = [[NSArrayController alloc] initWithContent:@[@"foo"].mutableCopy];
controller.filterPredicate = [NSPredicate predicateWithBlock:^BOOL(id _Nonnull evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
return [evaluatedObject isKindOfClass:[NSString class]];
}];
controller.clearsFilterPredicateOnInsertion = NO;
[controller addObject:@"bar"];
[controller addObject:@1]; // raises
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden