我正在开发一款应用程序,能够感知用户的位置,然后根据该位置调用特定的电话号码。根据用户的位置拨打不同号码的电话
我有实际的手机上调用此方法, - (IBAction)phone { [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"tel:123"]];
然后,我有用于获取用户的位置这种方法。
NSLog(@"Resolving the Address");
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"Found placemarks: %@, error: %@", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
_addressLabel.text = [NSString stringWithFormat:@"%@ %@\n%@ %@\n%@\n%@",
placemark.subThoroughfare, placemark.thoroughfare,
placemark.postalCode, placemark.locality,
placemark.administrativeArea,
placemark.country];
} else {
NSLog(@"%@", error.debugDescription);
}
} ];
根据用户的“placemark.locality”,我想打电话给不同的号码。 任何想法? 预先感谢您