The CoreMotion engine management class has a feature built-in to check for hardware availability. The Saurabh method will require you to update your application every time a new device with a gyroscope is released (iPad 2, etc.). Here's a sample code using Apple's documented property to check the availability of the gyro:
CMMotionManager *motionManager = [[[CMMotionManager alloc] init] autorelease]; if (motionManager.gyroAvailable) { motionManager.deviceMotionUpdateInterval = 1.0/60.0; [motionManager startDeviceMotionUpdates]; }
See the documentation for more details.
source share