Search code examples
iosios7xcode5

Could not instantiate class named GLKView


I got this exception:

2014-02-19 19:08:34.590 MyApp[42353:70b] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named GLKView'

It is because I tried to add a GL view to my xib file this way:

enter image description here

What I want to achieve is to draw gradient background beneath the View (the one with Label 'City')

It is probably a commonly-seen exception because any more experienced iOS developers can tell I have no clue what I am doing.

My Questions:

  1. Why this error message?
  2. Is it possible to add a GLKit View?
  3. What is a better way to add gradient background?

Solution

  • You probably simply just need to add the "GLKit" framework to your project.

    It's as simple as dragging the framework from the SDK folder into the "Frameworks" section of your project:

    Drag GLKit