Maxim Lanin
Maxim Lanin

Reputation: 4531

Check if user is in the defined area

In my app I want to check if my position is within defined area. I know the area coordinates and I want to check it when app is launched. How can I do it? As far as I know, geofencing can help me, but this technique always scans user's location. And I need only a manual check.

Upvotes: 2

Views: 172

Answers (1)

Nicholas Smith
Nicholas Smith

Reputation: 11754

If you've got the users coordinates from a manual check with CLLocationManager then store them as a CLLocation object, then have another CLLocation object that contains the centre point of the region you want to check. You can then use [someUserLocationObject distanceFromLocation:centralPointOfArea] which will give you the distance the user is (in metres) from the central point, and you can make a determination from there.

Upvotes: 2

Related Questions