ArrayController is nil at Runtime after awakeFromNib

Hello, here is the block where arrayController is nil :

{
    NSData * data;
    NSError * error;
    Class  klass;
    if(_arrayController != nil) // nil !
    {
        selected = [_arrayController selectedObjects];
        arranged = [_arrayController arrangedObjects];
        if([selected count] > 0)
        {
            _currentObject = [selected objectAtIndex:0];
            if(_currentObject != nil)
            {
                data = [_currentObject valueForKey:kVrRoot];
                klass = [NSMutableDictionary class];
                _vrRoot =
                    [NSKeyedUnarchiver unarchivedObjectOfClass:klass fromData:data error:&error];
            }else
            {
                _vrRoot = [NSMutableDictionary new];
                data = [NSKeyedArchiver archivedDataWithRootObject:_vrRoot requiringSecureCoding:YES error:&error];
            }
        }
    }
}

I use this for years so I don't no what's wrong.

  • I replaced the NSArrayController from the object library and renamed the @property(strong)IBOutlet NSArrayController * vrArrayController; Now runs awakeFromNib only one time and the controller is nil.

Add a Comment

Accepted Reply

Are you certain that the arrayController property on the AppDelegate reads/writes from/to the _arrayController instance variable? Does your AppDelegate contain a custom implementation of -setArrayController:? Does it still fail if you explicitly synthesize the property: @synthesize arrayController = _arrayController;?

Is the arrayController property declared strong or weak?

Replies

Are you certain that the arrayController property on the AppDelegate reads/writes from/to the _arrayController instance variable? Does your AppDelegate contain a custom implementation of -setArrayController:? Does it still fail if you explicitly synthesize the property: @synthesize arrayController = _arrayController;?

Is the arrayController property declared strong or weak?