Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check that CLLocationCoordinate2D is not empty?

Tags:

ios

cllocation

How to check that CLLocationCoordinate2D is not empty?

like image 223
Shmidt Avatar asked Nov 25 '11 18:11

Shmidt


1 Answers

A very old topic, but I needed it now and I fixed my issue with the help of Klaas Hermanns, with a tiny change.

Instead of

if( myCoordinate ==  kCLLocationCoordinate2DInvalid ) {   NSLog(@"Coordinate invalid"); } 

I had to use

if (CLLocationCoordinate2DIsValid(myCoordinate)) {   NSLog(@"Coordinate valid"); } else {   NSLog(@"Coordinate invalid"); } 

Maybe this will help someone else :)

Edit:

As pointed out, the initialization, as covered in Klaas his post, is still necessary.

like image 158
Rick van der Linde Avatar answered Oct 20 '22 02:10

Rick van der Linde