I don't know if this is a driver problem or my fault:

Code :
NSLog(@"GL_MAX_TEXTURE_SIZE: %d  (%d, %d)", GL_MAX_TEXTURE_SIZE, width, height);
NSLog(@"GL_MAX_SAMPLES: %d", GL_MAX_SAMPLES);
glGenTextures(1, &shadowTextureId);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, shadowTextureId);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_DEPTH_COMPONENT , width, height, false);
[YALog isGLStateOk:TAG];

The output is:

Code :
GL_MAX_TEXTURE_SIZE: 3379  (512, 512)
GL_MAX_SAMPLES: 36183
[YAShadowMap] glTexImage2DMultisample  [OpenGL] GL_INVALID_VALUE


GL_INVALID_VALUE is called if:

GL_INVALID_VALUE is generated if either width or height negative or is greater than GL_MAX_TEXTURE_SIZE.
GL_INVALID_VALUE is generated if samples is greater than GL_MAX_SAMPLES.

Both causes can be excluded.

My
NSOpenGLPixelFormatAttribute looks like this:

Code :
        NSOpenGLPFAMultisample  ,
        NSOpenGLPFASampleBuffers, 1,
        NSOpenGLPFASamples, 4,

and multisample is enabled:
Code :
glEnable(GL_MULTISAMPLE);