Anthony Kong
Anthony Kong

Reputation: 40634

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?

Upvotes: 3

Views: 1039

Answers (3)

Ariven Nadar
Ariven Nadar

Reputation: 1308

To solve this problem follow the steps

  1. In Project Navigator, click on Project Name ie. the first file.
  2. In TARGETS, click on Project File Name.
  3. Then click on Build Phases.
  4. Open Link Binary with Libraries.
  5. Click on "+" button at the bottom.
  6. A popup will appear, in that scroll down and select GLKit.framework and Add.

Note: if you Added any wrong framework just click on that framework and click on "-" button

Upvotes: 2

Michael Dautermann
Michael Dautermann

Reputation: 89509

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

Upvotes: 9

jervine10
jervine10

Reputation: 3077

You need to add the GLKit Framework to your project.

Upvotes: 2

Related Questions