- Joined
- Aug 15, 2008
- Messages
- 489
- Reaction score
- 43
I'm creating an iOS application that checks users current location and then calculates distance between set points.
I've managed to create a code that calculates the distance.
But the last line of code gives an error "Too many arguements to method call, expected 1, have 2".
I've managed to create a code that calculates the distance.
Code:
NSMutableArray * distances = [[NSMutableArray alloc] init];
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:mapView.userLocation.location.coordinate.latitude longitude:mapView.userLocation.location.coordinate.longitude]; // User
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:VILLAPAULI_LATITUDE longitude:VILLAPAULI_LONGITUDE]; // Location
NSLog(@"Distance is %f kilometers.", [location1 distanceFromLocation:location2] / 1000);
[distances addObject:@"%f", [location1 distanceFromLocation:location2]];
Last edited:

