Search code examples
iosobjective-cuiviewcontrollercrashuncaught-exception

this class is not key value coding-compliant for the key screenNumber


I have 2 computers running the same iOS code in Xcode (in a dropbox folder).
When creating an UIViewController, it works properly on one machine when the other gives: this class is not key value coding-compliant for the key screenNumber.

I have absolutely no reference of screenNumber in the code, and do not use any storyboard neither xib for this specific class.

Command that inits the view:

ChildViewController *childViewController = [[ChildViewController alloc] initWithIndex:index :100];

It crashes at random locations in this code:

 -(ChildViewController *)initWithIndex:(int)index :(int)maximumIndex
    {
        self = [super init];

        if (self)
        {
            NSLog(@"Init child:%d",index);
            // Custom initialization

            self.index=index;
            maxIndex=maximumIndex;
         }

        return self;
    }

ChildViewController is derived from UIViewController.
Error message received is:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ChildViewController 0x8e0f4d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key screenNumber.'

Any idea if I could potentially find the screenNumber reference in another folder that would not be in the project directory ? I don't exclude I may have used this variable in the past but not anymore.

Thanks


Solution

  • OK, found the issue. The simulator still had old files in it. Deleted home/Preferences/Application Support/iPhone Simulator/7.1/Applications/.