mapkit

-[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] error

穿精又带淫゛_ 提交于 2019-12-03 11:12:33
This is my code, showing both the alert and the blue dot for the current position on the map: MapName.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <CoreLocation/CoreLocation.h> @interface MapName : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> @property (strong, nonatomic) IBOutlet MKMapView *MapName; @property (strong, nonatomic) CLLocationManager *locationManager; @end MapName.m - (void)viewDidLoad { [super viewDidLoad]; self.locationManager = [[CLLocationManager alloc]init]; self.locationManager.delegate = self; if ([self.locationManager respondsToSelector:

How do I specify the zoom level when using an MKUserTrackingBarButtonItem?

前提是你 提交于 2019-12-03 10:22:47
I am using a MKUserTrackingBarButtonItem button to allow the user to automatically track their location on a map. The problem is that when they tap this button, it is zoomed too far out. I want it to start at a specified zoom level (i.e. span). How can I achieve this? When the user taps the button to change to MKUserTrackingModeFollow , it seems to use the same zoom level that the user last manually changed to (i.e. using gestures on the map). Attempting to specify a different zoom level via setRegion or setVisibleMapRect does not affect what zoom level will be used when the mode is changed to

Convert MapKit latitude and longitude to DMS format

 ̄綄美尐妖づ 提交于 2019-12-03 10:17:07
问题 I am able to determine the latitude and longitude of a location in the center of a map with the following: func TargetGridReference(outletMapView_PrimaryTargetLocationMap: MKMapView, regionDidChangeAnimated animated: Bool) { let ThreatGridReference = outletMapView_PrimaryTargetLocationMap.centerCoordinate let mapLatitude = String(format:"%.13f",ThreatGridReference.latitude) let mapLongitude = String(format:"%.13f",ThreatGridReference.longitude) let latAndLong = "Lat: \(mapLatitude) \nLong: \

How to know whether MKMapView visibleMapRect contains a Coordinate?

≡放荡痞女 提交于 2019-12-03 09:22:41
问题 If I have a MKMapView and a CLLocationCoordinate2D how do you test whether the map's visible area contains the coordinate? 回答1: The fastest way is to use the inbuilt Apple functions which will make this sort of thing super quick! if(MKMapRectContainsPoint(mapView.visibleMapRect, MKMapPointForCoordinate(coordinate))) { //Do stuff } Where coordinate is your CLLocation2D. This will be much faster than working out coordinates with a bulk if statement. Reason is that Apple use a Quadtree and can

IPhone : google maps directions

断了今生、忘了曾经 提交于 2019-12-03 09:22:10
i'm developing an iPhone app which embed a mapView made with mkmapkit. I got two coordinates and I'm tracing the direction between these two points. Everything works well. I'm using google maps api : maps.googleapis.com/maps/api/directions to retrieve xml with all the steps of the direction. But one thing is very strange : I just can't understand why driving direction is not accurate. Between two steps it trace a right line and don't follow the road while walking travel mode trace a very accurate direction, following roads. Driving Mode : http://www.michael-blin.fr/misc/aden/google/driving.png

MKMapView fails to load tiles with HTTP 410 error

北城余情 提交于 2019-12-03 09:16:42
问题 I have a problem with MKMapView . Map fails to load tiles when I zoom it in. -(void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error Error: Domain=GEOErrorDomain Code=-204 "(null)" UserInfo={SimpleTileRequesterUnderlyingErrors=( "Error Domain=GEOErrorDomain Code=-204 \"(null)\" UserInfo={HTTPStatus=410, NSErrorFailingURLStringKey= http://gspe19.ls.apple.com/tile.vf?flags=1&style=20&size=2&scale=0&v=11037825&z=15&x=6205&y=12336&sid

Mapkit with multi annotation (callout), mapping the next view

泪湿孤枕 提交于 2019-12-03 09:12:00
Wanted some help with a problem with mapkit I am facing. Should be a silly problem or I have missed out something while going through the mapkit framework. Here is the senario. I am placing multiple annotation on the map when the user performs some search like pizza. Added button for the right annotation view, on click which opens a next detail view. The problem is how to send some information to the next view, for example I add index to annotations while creating them, now I want to access this information from annotation, and pass it to the next view via the selector set on the button. I

How to test a protocol for a method?

感情迁移 提交于 2019-12-03 09:10:38
问题 Before iOS 4, I used to add a observer to each MKAnnotationView added to the map view, listening for it's selected method, so I know when the user has tapped on a pin. This worked fine up to iOS 4.2. I've noticed on the release noted annotation views are actually being reused and it somehow messes up with the observers. So I figure I can use the -mapview:didSelectAnnotationView: method from MKMapViewDelegate for my needs, but that has only been added to iOS 4.0 SDK. So, to maintain

Search nearby in iOS Maps

自作多情 提交于 2019-12-03 09:07:21
I am trying to build a simple application using MapKit that will automatically search for a specific place when the app launches and drop pin(s) on the map at the locations(s). I am seeing all sorts of ways to load locations (lat/lon, etc), but nothing that lets me search for a specific business name, restaurant name, etc. I am expecting to work with Apple Maps. However, if Google Maps would be a better solve than so be it. Any help would be appreciated. Thanks iOS >= 6.1 provides MKLocalSearch , MKLocalSearchRequest to search for natural language points of interest. Sample

How to draw route between two locations and plot main points also using MapKit?

丶灬走出姿态 提交于 2019-12-03 08:47:36
I am using MapKit api to get current location on map and drawing route between two location pointed by drop pins.I also want to get all the main stands between its route. I m using below function to get route between two location - (NSArray*)getRoutePointFrom:(MyLocation*)origin to:(MyLocation*)destination { NSString* saddr = [NSString stringWithFormat:@"%f,%f", origin.coordinate.latitude, origin.coordinate.longitude]; NSString* daddr = [NSString stringWithFormat:@"%f,%f", destination.coordinate.latitude, destination.coordinate.longitude]; NSURL *url=[NSURL URLWithString:[NSString