I'm using a particle emitter in an iPad project (not using SpriteKit), the particle emitter is generated inside a UIImageView and since iOS 9 this emitter is making the whole app crash. Actually, the whole iPad is crashing, the image freezes and nothing can make the iPad unfreeze short of restarting the iPad.
If I bring the birthrate down from 19.0f to 6.0f the iPad stops crashing. The image I am using is a png of 256 × 256 in size, I'm not sure if that might play a role in it crashing.
Everything was working fine in iOS 8.
I'm currently on iOS 9.0.1 on an iPad Air 2, using Xcode 7.0.1.
+(void)smogGeneral:(UIImageView *)myView{
[myView setNeedsDisplay];
CALayer *rootLayer = [myView layer];
CALayer *emitterSuperLayer = [CALayer layer];
emitterSuperLayer.bounds = myView.bounds;
emitterSuperLayer.sublayerTransform = CATransform3DMakeScale(1.0f, -1.0f, 1.0f);
[rootLayer addSublayer:emitterSuperLayer];
CGFloat midX = floorf(CGRectGetMidX(myView.bounds));
CGFloat midY = floorf(CGRectGetMidY(myView.bounds));
[emitterSuperLayer setPosition:CGPointMake(midX, midY)];
CAEmitterLayer *whiteSmokeEmitter = [CAEmitterLayer layer];
[whiteSmokeEmitter setName:@"whiteSmokeEmitter"];
whiteSmokeEmitter.zPosition = 0.00f;
whiteSmokeEmitter.emitterPosition = CGPointMake(300, 300);
whiteSmokeEmitter.renderMode = kCAEmitterLayerBackToFront;
whiteSmokeEmitter.emitterSize = CGSizeMake(10.00f, 10.0f);
whiteSmokeEmitter.velocity = 0.05f;
whiteSmokeEmitter.emitterMode = kCAEmitterLayerOutline;
whiteSmokeEmitter.emitterShape = kCAEmitterLayerRectangle;
CAEmitterCell *puffCell = [CAEmitterCell emitterCell];
[puffCell setName:@"puffCell"];
puffCell.contents = (__bridge id)[[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"smokeCell" ofType:@"png"]] CGImage];;
CGColorRef colorRefPuffcell = [UIColor colorWithRed:0.99f green:0.98f blue:1.00f alpha:0.10f].CGColor;
puffCell.color = colorRefPuffcell;
puffCell.scale = 0.2f;
puffCell.emissionLongitude = 1.84f;
puffCell.emissionRange = 1.11f;
puffCell.lifetime = 16.0f;
puffCell.birthRate = 19.0f;
puffCell.scaleSpeed = 0.15f;
puffCell.velocity = 2.56f;
puffCell.velocityRange = 9.80f;
puffCell.xAcceleration = 9.15f;
puffCell.yAcceleration = -0.01f;
whiteSmokeEmitter.emitterCells = @[puffCell];
[emitterSuperLayer addSublayer:whiteSmokeEmitter];
}