Estoy intentando simplemente NSLog la salida del nuevo iPhone 4 Giroscopio. Pero después de leer la documentación y seguir su código de muestra, obtengo este error.CMMotionManager y el giroscopio en el iPhone 4
ERROR,Time,300635803.946,Function,"CLLoggingSetFile",could not open locations log /var/mobile/Library/Caches/CoreMotion/CoreMotion.log
Incluso si acabo de configurar mi MotionManager objeto con [[alloc CMMotionManager] init]; por sí solo y sin otro código, sigo recibiendo el error.
Aquí está mi archivo .h.
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
@interface GyroTest0ViewController : UIViewController {
CMMotionManager *motionManager;
NSOperationQueue *opQ;
}
@end
Y aquí mi archivo .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];
}
}
Cualquier ayuda y/o código fuente para simplemente registrar los datos del giroscopio del iPhone 4 sería muy apreciada. ¡Muchas gracias!
Es un error que no afecta la ejecución de la aplicación. – twerdster
Después de que iOS 4.2 se apaga, el mensaje de error desapareció. Creo que podemos cerrar esto. – Kay
Recibo el mismo error cuando trato de registrar la 'actitud', pero el error no parece causar un problema real: el NSLog funciona. – RawMean