I have a Subview that has a button, when tapped opens up the map and location. There is no error in code but once I get sent to Maps and get back to my app.. It opens Maps once again. So I guess the method is being called twice. How do I stop this?
- (void)openMaps:(UITapGestureRecognizer *)tapAddress{
PFQuery *query = [PFQuery queryWithClassName:@"outfitDay"];
[query getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {
if (!error) {
NSURL *mapUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@", [object objectForKey:@"map"]]];
if ([[UIApplication sharedApplication] canOpenURL:mapUrl]) {
[[UIApplication sharedApplication] openURL:mapUrl];
} else {
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:nil message:@"Sin Servicio!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
}
}];
}