Search Results

Search found 2 results on 1 pages for 'user289503'.

Page 1/1 | 1 

  • Objective C / iPhone comparing 2 CLLocations /GPS coordinates

    - by user289503
    have an app that finds your GPS location successfully, but I need to be able to compare that GPS with a list of GPS locations, if both are the same , then you get a bonus. I thought I had it working, but it seems not. I have 'newLocation' as the location where you are, I think the problem is that I need to be able to seperate the long and lat data of newLocation. So far ive tried this: Code: NSString *latitudeVar = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.latitude]; NSString *longitudeVar = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.longitude]; An example of the list of GPS locations: Code: location:(CLLocation*)newLocation; CLLocationCoordinate2D bonusOne; bonusOne.latitude = 37.331689; bonusOne.longitude = -122.030731; and then Code: if (latitudeVar == bonusOne.latitude && longitudeVar == bonusOne.longitude) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"infinite loop firday" message:@"infloop" delegate:nil cancelButtonTitle:@"Stinky" otherButtonTitles:nil ]; [alert show]; [alert release]; this comes up with an error 'invalid operands to binary == have strut NSstring and CLlocationDegrees' Any thoughts?

    Read the article

  • Objective C / iPhone comparing 2 CLLocations /GPS coordinates help

    - by user289503
    Ok , so thanks to Claus Broch I made some progress with comparing two GPS locations. I need to be able to say "IF currentlocation IS EQUAL TO (any GPS position from a list ) THEN do something My code at the moment is : CLLocationCoordinate2D bonusOne; bonusOne.latitude = 37.331689; bonusOne.longitude = -122.030731; Which is the simulators GPS location at Infinite Loop CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:bonusOne.latitude longitude:bonusOne.longitude]; double distance = [loc1 getDistanceFrom:newLocation]; if(distance <= 10000000) { Then do something } Any number under 10000000 and it assumes that there is no match. Any ideas ? Thanks is advance.

    Read the article

1