Unfortunately, the cocos2d documentation is partially outdated. The method you specified no longer exists. Instead, you have to change the line in the application delegation application applicationDidFinishLaunching, which initializes the EAGLView. There's a “viewWithFrame” option that accepts additional depthFormat parameters:
// Create an EAGLView with a RGB8 color buffer, and a depth buffer of 24-bits EAGLView* glView = [EAGLView viewWithFrame:[window bounds] pixelFormat:kCCTexture2DPixelFormat_RGBA8888 depthFormat:GL_DEPTH_COMPONENT16_OES preserveBackbuffer:NO sharegroup:nil multiSampling:NO numberOfSamples:0];
source share