NSUnknownKeyException 🍎 iOS

NSUnknownKeyException: this class is not key value coding-compliant for the key x

A storyboard/XIB has a connection to an outlet or action that no longer exists in the class (renamed or deleted), or the view’s custom class is wrong.

Seen on: iOS

Meaning

Interface Builder stores outlet names. Renaming a property in code without reconnecting, or a wrong Custom Class/Module in the Identity inspector, triggers this when the view loads.

Common causes

  • Outlet renamed/deleted in code but still connected in IB
  • Wrong Custom Class on the view controller/view
  • Module not set (Inherit Module From Target)

⚡ Quick fix

  1. Open the storyboard, right-click the view controller and delete the broken (⚠️) connection
  2. Check the Custom Class and Module in the Identity inspector
  3. Reconnect the outlet

Detailed fix by platform

Xcode

  1. # Storyboard → select view controller → Connections inspector → remove outlets marked with "!"

How to diagnose

  1. Key — Name in the message
  2. Class — Identity inspector Custom Class

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.