0

I am new to iphone development.I want to know whether there is any method to check a person iphone is pointing towards a particular location or not.I cam to know that there is framework for CLLocation to get the heading of the device.But i also want to check if its poiting towards the right direction also. Destination location is obtained by longitude and latitude.Can any one suggest me a method for it?

thanks in advance

ashwin19
  • 29
  • 1
  • 6

1 Answers1

0

CLLocationManager will give you the heading, Check out the docs here-> https://developer.apple.com/library/mac/ipad/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

Also, check out this answer where they talk about CLLocationDirection and trueHeading -> https://stackoverflow.com/a/2043694/1104563

--- UPDATED

There is no built-in way to do this, you need to use a formula to determine this. The formula can be found here calculate bearing in relation to two points

In addition you can check out this SO answer: CLLocation Category for Calculating Bearing w/ Haversine function

Hope this helps. Good luck!

Community
  • 1
  • 1
ElasticThoughts
  • 3,417
  • 8
  • 43
  • 58