开发者

how to retrieve magnetic value from CLHeading

i'm trying with CLHeading to get compass value,

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
 if (curHeading != nil)
  [curHeading release];

 curHeading 开发者_如何学Go= newHeading;
 NSLog(@"%@",curHeading);
 [curHeading retain];
}

the above give result as -

magneticHeading 89.00 trueHeading +103.27 accuracy 5.00 x +1.375 y +41.875 z +37.438 @ 2010-01-18 10:18:37 +0800

but i need just the magneticHeading value, so

i alter the code as :

a)

newHeading.magneticHeading -> got result null

b)

newHeading.trueHeading -> Program received signal: “EXC_BAD_ACCESS”.

can anyone help, i just trying with other possible way to get the compass value.


magneticHeading and trueHeading are both of type CLLocationDirection, which is actually a double. If you want to NSLog() a double, you have to use "%f", or "%.9f", not "%@", which is for objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜