Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:53:05+00:00 2026-06-15T12:53:05+00:00

The code I have. By the way, I can’t get Call to work and

  • 0

The code I have. By the way, I can’t get Call to work and Website does not open either!

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *urlToOpen = @"";
if( indexPath.section == 0 ){
    // call number
    urlToOpen = @"tel:442074036933";
} else if( indexPath.section == 1 ){
    // open website
    urlToOpen = @"http://www.designmuseum.org";
} else {
    // open address

    urlToOpen = @"http://maps.apple.com/maps?daddr=Design+Museum+London";
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlToOpen]];
NSString *destinationAddress = [NSString stringWithFormat:@"%@+%@+%@",
                                [address street],
                                [address city],
                                [address country]];

NSString *sourceAddress = [LocalizedCurrentLocation currentLocationStringForCurrentLanguage];

NSString *url = [NSString stringWithFormat:@"http://maps.apple.com/maps?saddr=%@&daddr=%@",
                 [sourceAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
                 [destinationAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

I need to add destination address which for my App is = 28 Shad Thames, London, United Kingdom. Which format to write it in? because I cant get it to work and really need to sort this problem of my app real quick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:53:06+00:00Added an answer on June 15, 2026 at 12:53 pm

    You don’t need to create outlets for each cell.

    Is your didSelectRowAtIndexPath method called?

    Then you could just do:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        NSString *urlToOpen = @"";
        if( indexPath.section == 0 ){
            // call number
            urlToOpen = @"tel:12125551212";
        } else if( indexPath.section == 1 ){
            // open website
            urlToOpen = @"http://www.google.nl";
        } else {
            // open address
                NSString *destinationAddress = @"Amsterdam";
    
                Class itemClass = [MKMapItem class];
                if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
    
                    CLGeocoder *geocoder = [[CLGeocoder alloc] init];
                    [geocoder geocodeAddressString:destinationAddress completionHandler:^(NSArray *placemarks, NSError *error) {
                        if([placemarks count] > 0) {
    
                            MKPlacemark *placeMark = [[MKPlacemark alloc] initWithPlacemark:[placemarks objectAtIndex:0]];
    
                            MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:placeMark];
    
                            MKMapItem *mapItem2 = [MKMapItem mapItemForCurrentLocation];
    
    
                            NSArray *mapItems = @[mapItem, mapItem2];
    
                            NSDictionary *options = @{
                                            MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
                                            MKLaunchOptionsMapTypeKey:
                                            [NSNumber numberWithInteger:MKMapTypeStandard],
                                            MKLaunchOptionsShowsTrafficKey:@YES
                            };
    
                            [MKMapItem openMapsWithItems:mapItems launchOptions:options];
    
                        } else {
                            //error nothing found
                        }
                    }];
                    return;
                } else {
    
                    NSString *sourceAddress = [LocalizedCurrentLocation currentLocationStringForCurrentLanguage];
    
                    urlToOpen = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%@&daddr=%@",
                                 [sourceAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
                                 [destinationAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
                }
        }
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlToOpen]];
    }
    

    indexPath.section could also be indexPath.row, depending on how you made the tableView.

    Edit:
    I have added the ‘Get Directions’ part. This checks if it is ios5 or ios6.

    For ios5 I use the LocalizedCurrentLocation from this post http://www.martip.net/blog/localized-current-location-string-for-iphone-apps

    For ios6 I use the CLGeocoder to get the placemark and then open the map with it and the current location.

    Remember to add CoreLocation.framework and MapKit.framework

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any way I can get this working? I have a block of code: <p><a
i have following code for moving 4 picture around circular way,but it can rotate
I'm trying to find a way to not have code being duplicated when I
The only way i can describe this is showing the code I have already
Is there any way to have a code that opens a PDF file in
Do we have a way to view assembly and c code both using gdb.
I have 2 path objects in my android code.I have tried all the way
Is there any way or possibility to update an apps code and have the
many Places in the sample code i have seen 2 different way of @synthesize
I am looking for the Ruby-est way to solve a problem. I have code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.