1
由於某種原因,我的iPad2沒有提供動作態度信息。我正在做AFAIK正是人們說要做但仍然...沒有數據。CMDeviceMotion不提供態度信息
float angle = 0;
CMDeviceMotion *deviceMotion;
CMAttitude *attitude;
deviceMotion = motionManager.deviceMotion;
if (deviceMotion) {
attitude = deviceMotion.attitude;
[attitude multiplyByInverseOfAttitude:referenceAttitude];
angle = [attitude roll];
} else {
NSLog (@"Cannot get angles.");
}
在我的代碼早些時候,我這樣做:
motionManager = [[CMMotionManager alloc] init];
if (motionManager.gyroAvailable) {
[motionManager startGyroUpdates];
}
但是我從來沒有得到的角度。幫幫我?