Reputation: 1781
I've been running through a good Cocos2d tutorial to implement iAds and am close to getting it implemented (I get iAd messages from the console)...
I keep coming back to this Warning on:
CCGLView *eaglView = [[CCDirector sharedDirector] openGLView];
"Instance method '-openGLView' not found..."
I think it has something to do with the switch from calling GLView to CCGLView (cocos2d)...
Upvotes: 2
Views: 3848
Reputation: 42153
By using type CCGLView
, I guess you are using cocos2d-iphone 2.x, while 1.x doesn't have CCGLView
but have EAGLView
.
In 1.x usually we access the property openGLView
to get the OpenGL view object:
EAGLView *eaglView = [[CCDirector sharedDirector] openGLView];
In 2.x, CCDirector
class doesn't have such a property. Instead, CCDirector
is now a subclass of UIViewController
on iOS (and NSObject
on Mac OS X). So, if you want to get the OpenGL view object on iOS, just do this:
CCGLView *ccglView = (CCGLView *)[[CCDirector sharedDirector] view];
since view
is a property of UIViewController
.
Upvotes: 7