Im пытается запустить мое простое приложение, которое отображает ориентацию по умолчанию и ориентацию относительно магнитного севера как с точки зрения высоты, так и рулона. Код Xcode говорит о его успешной сборке, но когда я иду на симулятор, он автоматически возвращает меня на этот экран на Xcode. xcode iOS симулятор не показывает приложение, но xcode говорит, что нет ошибок
Симулятор - это просто черный экран. Heres все мой код, который не очень-файл только одна реализация:
//
// ViewController.m
// gyro_test
//
// Created by USER on 11/20/13.
// Copyright (c) 2013 taphappytech. All rights reserved.
//
#import <CoreMotion/CoreMotion.h>
#import "ViewController.h"
@interface ViewController(){
}
@property(nonatomic, strong) CMMotionManager *motionManager;
@end
@implementation ViewController
@synthesize motionManager;
@synthesize navPitch;
@synthesize navRoll;
@synthesize navYaw;
@synthesize magPitch;
@synthesize magRoll;
@synthesize magYaw;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
motionManager = [[CMMotionManager alloc] init];
//Start up the CMMotionManager
motionManager.deviceMotionUpdateInterval = 1.0/60.0;
//Set the update interval to 60Hz
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)natOrientation:(id)sender {
[motionManager startDeviceMotionUpdates];
double rRotation = motionManager.deviceMotion.attitude.roll*180/M_PI;
double pRotation = motionManager.deviceMotion.attitude.pitch*180/M_PI;
double yRotation = motionManager.deviceMotion.attitude.yaw*180/M_PI;
NSString *myString = [NSString stringWithFormat:@"%f",yRotation];
self.navYaw.text = myString;
myString = [NSString stringWithFormat:@"%f",pRotation];
self.navPitch.text = myString;
myString = [NSString stringWithFormat:@"%f",rRotation];
self.navRoll.text = myString;
}
- (IBAction)magOrientation:(id)sender {
NSOperationQueue *currentQueue = [NSOperationQueue currentQueue];
[self.motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXMagneticNorthZVertical toQueue:currentQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {NSLog(@"%@",motion.attitude);}];
double rRotation = motionManager.deviceMotion.attitude.roll*180/M_PI;
double pRotation = motionManager.deviceMotion.attitude.pitch*180/M_PI;
double yRotation = motionManager.deviceMotion.attitude.yaw*180/M_PI;
NSString *myString = [NSString stringWithFormat:@"%f",yRotation];
self.magYaw.text = myString;
myString = [NSString stringWithFormat:@"%f",pRotation];
self.magPitch.text = myString;
myString = [NSString stringWithFormat:@"%f",rRotation];
self.magRoll.text = myString;
}
@end
Почему это приложение не отображается на тренажере?
Отключить контрольную точку. – rmaddy
ha wow спасибо maddy. – ian