0

I recently deleted the xib for a particular UIViewController subclass. However, since then I have been getting the following error on device only, and not simulator:

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

I had set btnBack as an IBOutlet before in the XIB, and have since removed that property.

The XIB is deleted and I have cleaned the project countless times, but this issue still persists.

How can I go about finding where in my code this property is being set, or cleaning up this issue in XCode?

EDIT: To make this clear:

  • The xib used to exist, but has since been deleted.
  • All IBOutlet properties have been deleted as well.
  • The instantiation of the viewController happens using only code.
  • If I had not deleted the properties then this would not have happened.
  • This is probably an XCode bug, and I am hoping someone has faced this issue as well and solved it.
ZeMoon
  • 20,054
  • 5
  • 57
  • 98

2 Answers2

0

Please have a look at connection inspector. Is View properly connected to File's owner and btnBack connection removed properly?

Vinu David Jose
  • 2,569
  • 1
  • 21
  • 38
0

I don't know what really happened, but I hadn't yet overridden the -init method int the class.

After overriding all the init methods like so:

-(instancetype)init
{
    if (self = [super init])
    {

    }

    return self;
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder])
    {

    }

    return self;
}

-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
    {

    }

    return self;
}

Everything worked fine.

ZeMoon
  • 20,054
  • 5
  • 57
  • 98