Questions tagged [mkmapitem]

MKMapItem is used to represent the data about a specific point on a map.

MKMapItem is used to represent the data about a specific point on a map. It is most commonly used to represent the results of a map-related search (e.g., fetching directions or nearby points of interest) or to pass known data to the Apple Maps application for plotting and display.

For more information, please see the Apple Documentation for MKMapItem.

62 questions
18
votes
1 answer

display route on iOS 7 maps: addOverlay has no effect

i want display a point to point route inside my mapView, i use this code for create the route: - (IBAction)backToYourCar { MKPlacemark *sourcePlacemark = [[MKPlacemark alloc] initWithCoordinate:self.annotationForCar.coordinate…
Max_Power89
  • 1,710
  • 1
  • 21
  • 38
10
votes
1 answer

MKMapItem with specific Location

How can I launch the default maps app for iOS6 and pass it a custom location? For example: [[MKMapItem setLocation:MyLocation] openInMapsWithLaunchOptions:nil]; I followed the example here, but was unable to figure it out. How can I launch the…
Nils
  • 1,469
  • 3
  • 13
  • 17
9
votes
1 answer

How to pull out latitude/longitude coordinates from MKMapItem

I'm creating an app that uses CoreData to store points of interest. MKMapItem coordinates are accessible within mapItem.placemark.location. I'd like to pull out the individual latitude and longitude coordinates and store them in a…
Adrian
  • 16,233
  • 18
  • 112
  • 180
6
votes
2 answers

MKMapItem.openInMaps() displays place mark exactly 50% of the time

I've found that running some code to display a location in maps view MKMapItem.openInMaps() only works exactly 50% of the time. In fact it precisely alternates between the MKPlacemark being displayed and it not being displayed. For example every…
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
6
votes
3 answers

How to access the category or type of an MKMapItem

I'm writing an Application that makes use of MapKit. I have implemented MKLocalSearch and I get back an array of MKMapItem's. However I was wondering if it was possible to get the category of each of these items.For example in the Maps application…
Benny33
  • 475
  • 1
  • 6
  • 12
5
votes
1 answer

Parsing an MKMapItem with iOS

I want access to the data in a MKMapItem object. After searching for information, I am asking the community. According to the Apple class reference, there are these properties: placemark isCurrentLocation name phone number url If I log an…
Morkrom
  • 578
  • 7
  • 26
5
votes
2 answers

Multiple Locations on Map (using MKMapItem and CLGeocoder)

I'm trying to display multiple locations in MKMapItem. I am getting those locations from a CLGeocoder, unfortunately it only accepts one location. Even though I pass in an NSArray it just returns one location. The following works fine with a single…
Grey Code
  • 326
  • 5
  • 19
4
votes
2 answers

How to set the display name for MKPlacemark?

I'm trying to show routes of two places with Apple's Map. For the two places, I have both names and coordinates. MKMapItem *currentLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] …
xi.lin
  • 3,326
  • 2
  • 31
  • 57
3
votes
0 answers

(MKMapItem iOS10) marker disappear on map when add "name"

this code let latitude:CLLocationDegrees = location.coordinate.latitude let longitude:CLLocationDegrees = location.coordinate.longitude let coordinates = CLLocationCoordinate2DMake(latitude, longitude) let placemark…
3
votes
1 answer

How to set properties within a Closure/Block in Swift

I currently have two fields/properties within my view controller. We are using the calculateDirectionsWithCompletionHandler and trying to set my fields to the value of route.distance and route.expectedTravelTime. Here is the code for that: func…
Varun Varahabotla
  • 548
  • 2
  • 7
  • 16
3
votes
2 answers

MKMapitem's Placemark.name is nil when creating MKMapItem from MKPlacemark

MKPlacemark *placemark1 = [[MKPlacemark alloc] initWithPlacemark:mapItem1.placemark]; MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark1]; NSLog(@"placemark1.name is - %@", placemark1.name) placemark1.name is -…
mkjwa
  • 141
  • 2
  • 11
3
votes
2 answers

How to get back to my app after going to map app from my application in ios 6

I am using this code to display some location on map. Class mapItemClass = [MKMapItem class]; if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) { // Create an MKMapItem to pass to the Maps app …
Sawant
  • 395
  • 6
  • 22
2
votes
1 answer

Swift Organize UITableView by Users Distance from MKMapItems

can someone please help me understand how to organize my tableview by distance that is already pulling and displaying the data on how far the mapItems are from the users location. Have not seen anyone give a answer on the actual tableview. Thank…
LBIMBA
  • 43
  • 8
2
votes
1 answer

Swift MKMapItems distance from Users Location

Can someone please help me understand what I need to add to get the distance between the users location and the placemarks? I am just unsure what to change in the distanceLabel.text to make the number change to each Placemark. Thank You! import…
LBIMBA
  • 43
  • 8
2
votes
1 answer

Detect when mapItemForCurrentLocation fails to locate your device

I can't figure out how to test for a lack of success when getting the map's current location. let source = MKMapItem.mapItemForCurrentLocation() // returns an object with: // isCurrentLocation = 1 // name="Unknown location" I could test…
SimplGy
  • 20,079
  • 15
  • 107
  • 144
1
2 3 4 5