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 protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]