views:

333

answers:

1

Hi experts, i'm trying with CLHeading to get compass value,

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

    curHeading = 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

thanks

+2  A: 

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.

Ben Gottlieb
oops, thanks for the answer, really not realize about that,
Apache