Question

I have a software-hardware related issue that I'm trying to troubleshoot. My app was developed for iPhone4, iOS5 and uses Core Motion framework to process accelerometer and gyroscope data in real time. The app fails when running on iPhone 3GS with iOS5

My main core-motion method looks like this:

        [motionManager startDeviceMotionUpdatesToQueue:motionQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {

            //notify calibration delegate
            if(calibrationDelegate)
            {
                [calibrationDelegate collectCalibrationMotionData:motion];
            }
//a lot more processing

}

I have reports that iPhone3GS does not return yes to isGyroAvailable, while iPhone4 returns yes.

 BOOL accelerometerAvailable  =  (motionManager.isAccelerometerAvailable)?YES:NO;
 BOOL gyroscopeAvailable      =  (motionManager.isGyroAvailable)?YES:NO;

        if(!accelerometerAvailable && ! gyroscopeAvailable)
        {
//handle error
            remoteControlState = kRemoteControlStateError;

        }

I've painfully discovered that Apple sells my app to customers with iPhone4, 4s AND 3GS. The app does not work for customers with iPhone 3GS because the call above does not seem to pass the motion objects to the calibration delegate.

I do not have iPhone 3GS to test the app on, so I have a few questions:

  • Is it possible to specify anywhere in the XCode project properties that I want my app to run ONLY on iPhone4 and above? (or devices with gyroscope available?)

    Where can I find more information on iOS5 quirks like the one above to better understand how iPhone3GS differs from iPhone4?

Was it helpful?

Solution

Is it possible to specify anywhere in the XCode project properties that I want my app to run ONLY on iPhone4 and above? (or devices with gyroscope available?)

Yes, you would specify such dependencies in the UIRequiredDeviceCapabilities key of your Info.plist (gyroscope would be the requirement in this case).

However, for a released app, it's unfortunately impossible to add new requirements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top