I'm assuming this code is within a custom UIView, if so, make sure that you have overridden:
+ (Class)layerClass
So it should be:
+ (Class)layerClass
{
return [CAEmitterLayer class];
}
This will ensure that inside your UIView where you have
emitter = (CAEmitterLayer*)self.layer;
It is returning a CAEmitterLayer, rather than a normal CALayer which it does by default.
I'm guessing this is the issue since the error is stating you are trying to call a method that only exists on CAEmitterLayer on a normal CALayer.