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 8950009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:21:04+00:00 2026-06-15T13:21:04+00:00

I am building an application that is using Mapkit. I know that this is

  • 0

I am building an application that is using Mapkit. I know that this is only available in IOS6.
So I should check if this is available or not. I am using the following code.

  if(NSClassFromString(@"MKMapKit")) {
        // MKMapKit is available in this OS
        CLLocationCoordinate2D coords =
        CLLocationCoordinate2DMake(51.097185,5.621653);

        NSDictionary *address = @{
        (NSString *)kABPersonAddressStreetKey: @"Weg naar oqdffds 59",
        (NSString *)kABPersonAddressCityKey: @"Msfsf",
        (NSString *)kABPersonAddressStateKey: @"Limbusqfqsdf",
        (NSString *)kABPersonAddressZIPKey: @"3670",
        (NSString *)kABPersonAddressCountryCodeKey: @"BE",
        (NSString *)kABPersonPhoneMainLabel:@"04741234567"
        };
        MKPlacemark *place = [[MKPlacemark alloc]
                              initWithCoordinate:coords addressDictionary:address];

        MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];
        mapItem.phoneNumber = @"0141343252";

        //current location
        MKMapItem *mapItem2 = [MKMapItem mapItemForCurrentLocation];


        NSArray *mapItems = @[mapItem, mapItem2];

        NSDictionary *options = @{
            MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
            MKLaunchOptionsMapTypeKey:
            [NSNumber numberWithInteger:MKMapTypeStandard],
            MKLaunchOptionsShowsTrafficKey:@YES
        };

        [MKMapItem openMapsWithItems:mapItems launchOptions:options];


    }else {
        NSLog(@"tot hier");
        // MKMapKit is not available in this OS
        locationController = [[MyCLController alloc] init];
        locationController.delegate = self;
        [locationController.locationManager startUpdatingLocation];
    }

But for some reason or another it always use the google method.

Can anybody help!

  • 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-15T13:21:05+00:00Added an answer on June 15, 2026 at 1:21 pm

    As already mentioned, MapKit has been available well before iOS 6.

    What you want to check for is MKMapItem (not “MKMapKit”).

    However, as the documentation for MKMapItem explains (with a code example):

    To determine whether a class is available at runtime in a given iOS
    release, you typically check whether that class is nil. Unfortunately,
    this test is not cleanly accurate for MKMapItem. Although this class
    was publicly available starting with iOS 6.0, it was in development
    prior to that.
    Although the class exists in earlier releases, you
    should not attempt to use it in those releases.

    To determine at runtime whether you can use map items in your
    application, test whether the class and the
    openMapsWithItems:launchOptions: class method exist.
    That method was
    not added to the class until iOS 6.0. The code might look like the
    following:

    Class itemClass = [MKMapItem class]; 
    if (itemClass && [itemClass 
        respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {   
        // Use class 
    }
    

    So this check:

    if(NSClassFromString(@"MKMapKit")) {
    

    should be:

    Class itemClass = [MKMapItem class]; 
    if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
    

    or:

    Class itemClass = NSClassFromString(@"MKMapItem"); 
    if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a web application and have been told that using object oriented
I'm building a windows application that search items from sharepoint document libraries, using the
I'm building a WinForms application Window (form), inside that I'm using a FlowLayoutPanel, with
I am building a web application using ASP.NET MVC that has two very distinct
I am building a twitter application that is currently using the classic login instead
I'm building an application that runs on a Windows Mobile device. I'm using Microsoft's
OK, I am building an application that will be using ASIHttpRequest in several places
I am building an application that has the functionality like 3 tabs created using
I am currently building a java-servlet-based web application that should offer its service to
I'm planning on building an application that simplifies web design. I intent using Lazarus/FreePascal

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.