I have a UIViewController subclass that used to have an associated nib file. I’ve since deleted the nib file and changed how it’s loaded:
FakeNameViewController *vc = [[FakeNameViewController alloc] init];
rather than:
FakeNameViewController *vc = [[FakeNameViewController alloc] initWithNibName:@"FakeNameViewController" bundle:nil];
When the view controller loads though it crashes with:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<FakeNameViewController 0x58b4510> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key successView'
It looks like the app is still trying to use a nib file, because “successView” was the original name of an IBOutlet. Cleaning does not fix the problem. It seems like it’s only fixed when I delete the app before running.
This worries me. I suspect it will cause the app the crash when people update through the AppStore. Is there a safe way to delete a nib file from a project?
When you install an app through Xcode, it doesn’t delete the files that were originally there, so the original nib is still being detected and loaded. You can work around this by cleaning and deleting your app from your device. I don’t believe the old files in the bundle are kept around for App Store upgrades.