• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSArrayController - error inserting object at arranged object index N
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSArrayController - error inserting object at arranged object index N
      • From: Jonathan Mitchell <email@hidden>
  • Prev by Date: Re: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • Next by Date: Re: NSArrayController - error inserting object at arranged object index N
  • Previous by thread: Re: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • Next by thread: Re: NSArrayController - error inserting object at arranged object index N
  • Index(es):
    • Date
    • Thread