mapkit

Call Maps for directions from inside your app - iOS5 iOS6

江枫思渺然 提交于 2019-12-03 02:06:26
问题 Here is a strange problem: My app should be able to call the built in Maps in iOS (both 5.1 and 6). Turns out that it works just fine under iOS6 but not under iOS5.1. The maps in iOS6 is called and the directions from saddr to daddr is traced but when I am in iOS5 the maps app is called but just one pin is put at the daddr. For some unknown reason the initial coordinates (saddr) are not showing and no direction is traced. Here is my code: addr = [NSString stringWithFormat: @"maps://saddr=%f,

MKAnnotationView layer is not of expected type: MKLayer

别等时光非礼了梦想. 提交于 2019-12-03 02:01:01
So my code works fine but my logger is riddled with this message. Is there a way to get rid of it or suppress it? PostAnnotation.swift class PostAnnotation: MKPointAnnotation { //MARK: properties let post: Post //MARK: initialization init(post: Post) { self.post = post super.init() self.coordinate = CLLocationCoordinate2D(latitude: post.latitude, longitude: post.longitude) self.title = post.title self.subtitle = post.timeString() } } Adding the annotation let annotation = PostAnnotation(post: post) self.map.addAnnotation(annotation) func mapView func mapView(_ mapView: MKMapView, viewFor

iOS: Notification when MKMapView is loaded and annotations/overlays are added?

做~自己de王妃 提交于 2019-12-03 01:29:09
I am aware of the delegate methods used to let me know when the map has loaded and annotations and overlays have been added. ( mapViewDidFinishLoadingMap: mapView:didAddAnnotationViews: mapView:didAddOverlayViews: ) I am wanting to create a UIImage from my MKMapView once everything has loaded. Currently I am creating my UIImage once mapView:didAddOverlayViews: is called, but this is not always reliable, because sometimes the overlay take longer to be added, sometimes mapViewDidFinishLoadingMap: is called more than once or it takes a long time to load. Sometimes it is NOT called because tiles

VectorKit crash reports with MKMapSnapshotter on iOS

不羁岁月 提交于 2019-12-03 00:54:02
I'm getting different kind of crash reports related to VectorKit and MKMapSnapShotter . Crashes occur pretty random, but it seems like they happen most when returning from the background. The device does not send out any memory warnings before it happens. What's happening here? I'm using: if (!_snapshotQueue) { _snapshotQueue = dispatch_queue_create("com.bestappever.snapshot", DISPATCH_QUEUE_SERIAL); } [_snapshotter cancel] _snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options]; __weak __typeof(self)__self = self; [_snapshotter startWithQueue:queue completionHandler:^(MKMapSnapshot

iOS 10 MapKit previous layer zoom issue

試著忘記壹切 提交于 2019-12-02 23:48:52
I am working in a map application which renders a polyline over a map. I am having an issue when zooming, it keeps the previous polyline on the tile. I have tried to force redrawing: [self.mapView reloadInputViews]; [self.mapView.layer setNeedsDisplay]; [self.mapView setNeedsDisplay]; Also I tried to slow the zoom speed, but the issue is still in there: [MKMapView animateWithDuration:2 delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:10 options:UIViewAnimationOptionCurveEaseOut animations:^{ [self.mapView setVisibleMapRect:unionRectThatFits edgePadding:UIEdgeInsetsMake(20, 10, 20, 10)

How to know whether MKMapView visibleMapRect contains a Coordinate?

时间秒杀一切 提交于 2019-12-02 23:38:24
If I have a MKMapView and a CLLocationCoordinate2D how do you test whether the map's visible area contains the coordinate? 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 do fast lookups for you. Swift 3 compatible If you frequently work with maps I suggest you to create an

MKMapView fails to load tiles with HTTP 410 error

走远了吗. 提交于 2019-12-02 23:32:15
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=0246704635757302674107153038443966765357&accessKey=1454685602_q3bVUYvHBdxsSo0A_j0fK7EyQ9b21NPShV7GRLzr4WFkkhxB4vO7

How to test a protocol for a method?

心已入冬 提交于 2019-12-02 23:19:48
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 compatibility, I'd like to implement this method on my delegate and conditionally check for the presence of this

MapKit Show Entire Globe

白昼怎懂夜的黑 提交于 2019-12-02 22:31:49
问题 I am trying to draw the entire globe inside my MKMapView. By pinching to zoom out I am limited to zooming out to a certain level. I would like to be able to zoom out past this level to show the entire globe on the map. This doesn't seem like it would be very difficult, but I have been unable to find any solution. 回答1: The map inside an MKMapView doesn't repats on the sides, so you can't zoom out far enough to view the whole world. Solution: Write your own renderer (very hard task, working

Trying to get the span size in meters for an iOS MKCoordinateSpan

房东的猫 提交于 2019-12-02 22:25:01
When I need to make an MKCoordinateRegion , I do the following: var region = MKCoordinateRegion .FromDistance(coordinate, RegionSizeInMeters, RegionSizeInMeters); very simple - works perfectly. Now I wish to store the value of the current region span . When i look at the region.Span value, it’s an MKCoordinateSpan which has two properties: public double LatitudeDelta; public double LongitudeDelta; How can I convert the LatitudeDelta value into a latitudinalMeters please? (So then I can recreate my region (later on) using the above method... Hannes As I can see you already have the region of