2012-08-13 3 views
1

CoreMotion을 사용하여 기울이기 정보를 얻는 작은 응용 프로그램을 개발했습니다.이 CoreMotion 코드를 망막 iPod touch 장치에서 작동시키는 방법은 무엇입니까?

하지만 iPod touch에서는 작동하지 않습니다. iOS 5.1이 적용된 첫 번째 망막 디스플레이 iPod touch에서 테스트했습니다. gyroAvailable 속성은 YES를 반환하므로이 iPod에는 자이로가 있다고 가정합니다.

이 코드는 아이폰 4에 잘 작동 :

CMMotionManager *mm = [[CMMotionManager alloc] init]; 
self.motionManager = mm; 
[motionManager setDeviceMotionUpdateInterval:0.05]; 

CMDeviceMotionHandler motionHandler = ^(CMDeviceMotion *motion, NSError *error) { 
    [self handleMotion:motion error:error]; 
}; 

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXArbitraryCorrectedZVertical toQueue:[NSOperationQueue currentQueue] withHandler:motionHandler]; 

startDeviceMotionUpdatesUsingReferenceFrame 범인을 것 같다하지만이 방법은 더 자이로이없는 장치에서 작동하지 않을 것을 문서로부터 알아낼 수 없었다.

사용자가 세로 모드에서 왼쪽 또는 오른쪽으로 기울이는 정도를 정확하게 출력해야합니다.

어떤 대안이 있습니까?

답변

2

iPod을 사용하려면 'CMAttitudeReferenceFrameXArbitraryZVertical'을 사용하십시오. iPad에는 자력계가 없으므로

관련 문제