2014-01-20 4 views
1

많은 게시물과 dev 매뉴얼을 읽었으므로 정확히 데이터를 가져올 수 있도록 CMCalibratedMagneticField를 설정하는 방법을 찾을 수 없습니다.CMCalibratedMagneticField 설정

내가 사용하고 있습니다 :

[motionManager startDeviceMotionUpdatesUsingReferenceFrame: CMAttitudeReferenceFrameXMagneticNorthZVertical toQueue: [NSOperationQueue currentQueue] withHandler:^(CMDeviceMotion *motion, NSError *error){ 
    //This is where I don't know how to get the calibrated data but I am trying: 
    CMCalibratedMagneticField *magfield = motion.magneticField.field; 
    //then sending it to a function where I pull the x, y, and z values. 

내가이 문서하지만 난 그냥 설정의 구문을 이해하고 있지 않다대로 바보 같은 질문이 될 수 있다는 것을 알고있다. 어떤 도움이라도 대단히 감사 할 것입니다.

답변

0

그래서 그것을 설정하는 적절한 방법은 다음과 같습니다 내 코드에서

CMCalibratedMagneticField magfield = motion.magneticField; 
//send in the magfield to the function. 

나는 간접적으로이 코드의 기능 측의 값을 참조하려고 때문에 그것에서 직접적인 값을 얻을 수 없습니다이었다 . 하지만 내 함수 호출은 지금과 같이 보인다 :

-(void)showMagneticfield:(CMCalibratedMagneticField)magfield 

다음 magfield.field을 수행하여 다양한 분야를 호출 (축)

.