0

I have downloaded the Xcode 10 GM and my app crashes immediately when running in Simulator. Xcode says: 


Unknown class _TtC7App-Name14ViewController in Interface Builder file.

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

However when I open my project in Xcode 9, there is no error and my app works perfectly. I searched for this problem and I tried everything that other people suggested on stackoverflow. From checking all the storyboard object and constraint connections, to making sure that the Classes are right and Inherit Module From Target is checked. I also tried „Erase All Content And Settings“ in Simulator and deleting the DerivedData folder. Removing the backgroundImage in Storyboard and code didn’t help, because then I got the same error but with another object from the same ViewController.

Does anyone have the same issue and found a solution?

EDIT: When I add a new View Controller and set it to "is initial ViewController", the view does load in Simulator. As soon as I add a swift file and set the Class in Interface Builder for that new ViewController, I get the Unknown Class warning. And when I add a label or any object, I get: Unknown class AND NSUnknownKeyException. So there's definitely nothing wrong with a specific ViewController or object. If someone had the same problem, please help me. I can't do anything anymore with this project :(

ViewController Identity Inspector

Storyboard Source Code

11
  • 1
    Let's concentrate on the Identity inspector. It is clear that your setting for the view controller's class in Interface Builder for ViewController is not being obeyed. Do you remember to hit Return? When you do, do you see the Module filled in? Did you check Inherit Module From Target?
    – matt
    Sep 22, 2018 at 17:13
  • I uploaded two screenshots that show how it looks like at the moment. I tried deleting the Class in Identity Inspector and entering it again, but no success.
    – olegtop
    Sep 22, 2018 at 19:11
  • I'm curious about the module name VOYAGE_ in those screen shots. Does your app's name end in a punctuation mark?
    – matt
    Sep 22, 2018 at 19:22
  • My app's name ends with an é, but I didn't have problems with that in Xcode 8 and 9.
    – olegtop
    Sep 22, 2018 at 19:30
  • Bingo. I am suggesting that you do have problems with that in Xcode 10. This would explain everything. Your module's name is not VOYAGE_ so the class cannot be found on that basis. Make sense?
    – matt
    Sep 22, 2018 at 19:31

1 Answer 1

1

The problem is that your project name (and all that follows from that) is not pure ascii alphanumeric (in particular, it contains a diacritic, an "é" character). This can mess things up in subtle ways. I don't know why Xcode 10 chokes on this but Xcode 9 doesn't, but there it is.

The solution is to change the project name and allow the renaming cascade that this causes. Then edit the Display Name so that it's the way you want it; that's the user-facing name of the app, and an "é" in that is perfectly fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.