I am new in iOS. I want to use CAEmitterLayer, which is only support by iOS 5, but my app should support iOS 4 and above. I am using [UIDevice currentDevice].systemVersion
to check the version, but it crashes.
Here is the code:
@class CAEmitterLayer;
@interface FireView : UIView
@property (strong) CAEmitterLayer *fireEmitter;
@property (strong) CAEmitterLayer *smokeEmitter;
- (void) setFireAmount:(float)zeroToOne;
@end
// create the FireView if iOS>=5.0
if ([[UIDevice currentDevice].systemVersion doubleValue] >=5.0) {
FireView *fireView = [[[FireView alloc] initWithFrame:CGRectMake(0, 95, 100, 280)] autorelease];
[self.view addSubview:fireView];
}
The problem is it crash before I create the FireView.
error:dyld: Symbol not found: _OBJC_CLASS_$_CAEmitterCell
even I don’t include the FireView.h file, still crashes.
Should I create both iOS4 and iOS5 version?
Can you give me some advice?
Please help. Thank you very much.
You can check to see if CAEmitterLayer class is available on current device’s iOS version by: