Below is the code that I used to continuously update the geographic direction.
CGFloat currentHeading = newHeading.magneticHeading; NSString *strDirection = [[NSString alloc] init]; if(gradToRotate >23 && gradToRotate <= 67){ strDirection = @"NE"; } else if(gradToRotate >68 && gradToRotate <= 112){ strDirection = @"E"; } else if(gradToRotate >113 && gradToRotate <= 167){ strDirection = @"SE"; } else if(gradToRotate >168 && gradToRotate <= 202){ strDirection = @"S"; } else if(gradToRotate >203 && gradToRotate <= 247){ strDirection = @"SW"; } else if(gradToRotate >248 && gradToRotate <= 293){ strDirection = @"W"; } else if(gradToRotate >294 && gradToRotate <= 337){ strDirection = @"NW"; } else if(gradToRotate >=338 || gradToRotate <= 22){ strDirection = @"N"; }
It works great on my part. Owners can let me know if any changes are required.
source share