iphone - CLLocationDistance NaN -


I am trying to calculate the distance between the two sets of coordinating points in the iPhone application on the fly

- (CLLocationDistance) getDistanceFrom: (const CLLocation *) Location

I have noticed that I started receiving NaN in strange places, thus investigating this matter Near, hard code value with the following

CLLocationDistance testDistance; Location Location = [[CLLocation alloc] initWithLatitude: 12.236533 Longitude: 11.011419]; UserLocation = [[CLLocation alloc] initWithLatitude: 12.236533 Longitude: 11.011419]; TestDistance = [get user location special place location]; If (Adnan (Test Distance)) NSLog (@ "ISNN!"); [Place space]; [User space release];

Many times the above is called, and in some situations testDistance is NaN.

I am afraid that I am missing something very easily here. Anyone have any ideas?

Update 1:

OK, so I took the above code into a new project (put everything in the app representative), It stopped for 100 times and all is fine. Thus it indicates that the problem is related to the project, but this helps very little ... because all the variables are within the scope of 1 function.

Solution:

Okay, this is a simulator bug that runs perfectly well on the same code build tool. Solution of the case.

You are saying that when you actually get the NaN exactly Same late / long? Wow ...

One thing you can do is to reverse the test - if you get the NAC, then try two CLLocations again:

  TestDistance = [placeLocation getDistanceFrom: userLocation];  

and see that the result always matches; That is, both ways, both nor for neither nor for the NAN, nor in both ways.

There will be one more thing to check when you test

  testDistance = [userLocation getDistanceFrom: userLocation];  

I'm sorry, this is not an answer, but maybe we can get some more clues.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -