iPhone 4上的CMMotionManager和陀螺仪 [英] CMMotionManager and the Gyroscope on iPhone 4
问题描述
我试图简单地NSLog新iPhone 4陀螺仪的输出。但在阅读文档并遵循其示例代码后,我收到此错误。
I am trying to simply NSLog the output of the new iPhone 4 Gyroscope. But after reading the documentation and following their sample code I am getting this error.
ERROR,Time,300635803.946,Function,"CLLoggingSetFile",could not open locations log /var/mobile/Library/Caches/CoreMotion/CoreMotion.log
即使我只是用[[CMMotionManager alloc] init]设置我的motionManager对象;我自己也没有其他代码,我仍然得到错误。
Even if I just setup my motionManager object with [[CMMotionManager alloc] init]; on its own and no other code, I still get the error.
这是我的.h文件。
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
@interface GyroTest0ViewController : UIViewController {
CMMotionManager *motionManager;
NSOperationQueue *opQ;
}
@end
这里是我的.m文件。
- (void)viewDidLoad {
[super viewDidLoad];
// the error occurs even just with this line on its own
motionManager = [[CMMotionManager alloc] init];
if (motionManager.gyroAvailable) {
motionManager.gyroUpdateInterval = 1.0/60.0;
[motionManager startGyroUpdates];
opQ = [[NSOperationQueue currentQueue] retain];
CMGyroHandler gyroHandler = ^ (CMGyroData *gyroData, NSError *error) {
CMRotationRate rotate = gyroData.rotationRate;
NSLog(@"rotation rate = [%f, %f, %f]", rotate.x, rotate.y, rotate.z);
};
} else {
NSLog(@"No gyroscope on device.");
[motionManager release];
}
}
任何简单记录的帮助和/或源代码iPhone 4陀螺仪数据将非常受欢迎。非常感谢!
Any help and/or source code to simply log the iPhone 4 gyroscope data would be much appreciated. Many thanks!
推荐答案
有关此问题的任何结果?即使我使用WWDC茶壶演示代码,我也会得到同样的错误。
我提交了一份错误报告(8382659)。
Any results regarding this issue? I get the same error even when I use WWDC teapot demo code. I filed a bug report (8382659).
当我使用Joshua Weinberg描述的推送方法时,我得到了同样的错误。
By the way I get the same error when I use the push method described by Joshua Weinberg.
更新:Apple确认了该错误,但提到了我找不到的重复问题8173937。好吧,我们希望它能在下一个版本中修复。
Update: Apple confirmed the bug but referred to a duplicate issue 8173937 that I can't find. Well let's hope that it will be fixed in the next release.
这篇关于iPhone 4上的CMMotionManager和陀螺仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!