简体   繁体   English

iOS5 CMMotionManager startDeviceMotionUpdatesToQueue:在iPhone3GS上失败

[英]iOS5 CMMotionManager startDeviceMotionUpdatesToQueue: fails on iPhone3GS

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. 我的应用程序是为iPhone4,iOS5开发的,并使用Core Motion框架实时处理加速度计和陀螺仪数据。 The app fails when running on iPhone 3GS with iOS5 在具有iOS5的iPhone 3GS上运行时,该应用程序失败

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. 我有报告说iPhone3GS不会将isGyroAvailable返回yes,而iPhone4则返回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. 我很痛苦地发现Apple向使用iPhone4、4s和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. 该应用程序不适用于使用iPhone 3GS的客户,因为上述调用似乎并未将运动对象传递给校准代表。

I do not have iPhone 3GS to test the app on, so I have a few questions: 我没有iPhone 3GS可以测试该应用程序,因此我有几个问题:

  • Is it possible to specify anywhere in the XCode project properties that I want my app to run ONLY on iPhone4 and above? 是否可以在XCode项目属性中的任何位置指定我希望我的应用仅在iPhone4及更高版本上运行? (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? 在哪里可以找到有关上述iOS5怪癖的更多信息,以更好地了解iPhone3GS与iPhone4的不同之处?

Is it possible to specify anywhere in the XCode project properties that I want my app to run ONLY on iPhone4 and above? 是否可以在XCode项目属性中的任何位置指定我希望我的应用仅在iPhone4及更高版本上运行? (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). 是的,您可以在Info.plist的UIRequiredDeviceCapabilities键中指定此类依赖关系(在这种情况下,必须使用gyroscope )。

However, for a released app, it's unfortunately impossible to add new requirements. 但是,对于已发布的应用程序,不幸的是不可能添加新的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM