mapkit

Calculate distance between my location and a MapKit pin on Swift

泪湿孤枕 提交于 2019-12-07 06:04:41
问题 I need your help, I'm working on an App where I have some pins (locations) and what I want is to get the distance between each one and my location. My code is the following let annotation = MKPointAnnotation() let annotationTwo = MKPointAnnotation() let saintPaulHospitalBC = MKPointAnnotation() override func viewDidLoad() { super.viewDidLoad() mapita.showsUserLocation = true // Mapita is the name of the MapView. annotation.coordinate = CLLocationCoordinate2D(latitude: 25.647399800, longitude:

How accurate is CoreLocation's accuracy measurement

痴心易碎 提交于 2019-12-07 03:33:47
问题 I have been testing the accuracy of various aspects of CoreLocation and have been surprised to find the accuracy value supplied on new and old locations passed to the CLLocationMangerDelegate method: (void)locationManager:didUpdateToLocation:fromLocation is wildly inaccurate itself. Walking certain stretches of pavement(along a stretch of road with buildings along one side) I have found that whilst CLLocationManager claims the CLLocations it is supplying have a horizontal accuracy of 5 meters

MKMapView tiles not loaded with zoom

两盒软妹~` 提交于 2019-12-07 03:28:57
问题 I've got an issue. I'm using a MKMapView for displaying some annotations. I initialize a map view with default zoom. And it displays some map. but when i try zooming, tiles not loaded, and map becomes empty. Like this. I create my Map View via interface builder. @property (nonatomic, weak) IBOutlet MKMapView* mapView; What am I doing wrong? Is there any mandatory methods for implementation, that affect on this functional? And yes, there is an internet connection on my device. 回答1: Generally

using CLLocation objects as keys in dictionary

我是研究僧i 提交于 2019-12-07 03:16:48
问题 Is it possible to use CLLocation objects as keys in a dictionary? When I try this, the [dictionary objectForKey: clLocationObj] always returns nil even when there are CLLocation keys already inserted with exactly the same latitude and longitude. What could I be doing wrong? for (Location *location in someArray) { CLLocation *locationKey = [[CLLocation alloc] initWithLatitude:[location.latitude doubleValue] longitude:[location.longtitude doubleValue]]; LocationAnnotation *annotationAtLocation

How to: Display MKOverlay on MKMapView

大兔子大兔子 提交于 2019-12-07 03:09:37
问题 I need to display an MKOverlay on a map, but can't get it to actually appear. I'm following the example from Apple's Location Awareness Programming Guide and the overlay wont display. Any help would be greatly appreciated, this is the first iPhone app I've made, so I might be missing something simple. NavViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface NavViewController : UIViewController <MKMapViewDelegate> { } @property (weak, nonatomic) IBOutlet MKMapView

iOS 7 MapKit Crash: EXC_BAD_ACCESS in [VKRasterOverlayTileSource invalidateRect:level:]

邮差的信 提交于 2019-12-07 02:26:48
问题 I have an unreproducible crash on iOS 7 only. I'm making heavy use of MKOverlayRenderer to draw shapes on the map. This crash does not happen on iOS 6. Any ideas of what this might be related to will be useful. Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x291707628 Stack: 0 libobjc.A.dylib objc_msgSend + 5 1 VectorKit __50-[VKRasterOverlayTileSource invalidateRect:level:]_block_invoke_2 + 38 2 VectorKit -[VKTileKeyMap enumerateKeysAndObjectsUsingBlock:] + 58 3 VectorKit -

MKUserLocation is selectable, falsely intercepting touches from custom MKAnnotationViews

风格不统一 提交于 2019-12-07 00:28:31
问题 I have a normal map in my iOS app where "Shows Users Location" is enabled - meaning I have my normal blue dot on the map, showing my position and accuracy info. The callout is disabled in code. But I also have custom MKAnnotationViews that are plotted around the map which all have custom callouts. This is working fine, but the problem is that when my location is on the location of a MKAnnotationView, the blue dot (MKUserLocation) intercepts the touch, so the MKAnnotationView doesn't get

How to find direction between two location in iPhone application?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 23:47:34
I am trying to find direction between two location using iOS framework but I am not able to find proper solution . You can use different methods for finding the direction between two location. (1) Using Google Maps NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", currentLatitude, currentLongitude, destinationLatitude, destinationLongitude]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; (2) Using Apple Maps: NSString *urlString = [NSString

missing required architecture i386 in file

混江龙づ霸主 提交于 2019-12-06 18:45:12
问题 I am having trouble building my app after adding MapKit and CoreLocation frameworks. They are both 4.3 frameworks, and the app used to work fine with UIKit, CoreGraphics, and Foundation, just giving me problems with these two. Not sure what the required architecture is, there aren't any bugs in the code. Any help is appreciated! ld: warning: ignoring file /Users/F3d3r3r/Desktop/testNav4_3/MapKit.framework/MapKit, missing required architecture i386 in file ld: warning: ignoring file /Users

How to handle touch gestures in SwiftUI in Swift UIKit Map component?

半城伤御伤魂 提交于 2019-12-06 17:34:26
I tried to handle Map UIKit component gestures in SwiftUI application. Xcode shows this warning: "String literal is not a valid Objective-C selector" // Binding to UIKit component import SwiftUI import MapKit struct MapView: UIViewRepresentable { class Coordinator: NSObject, MKMapViewDelegate { @Binding var selectedPin: MapPin? init(selectedPin: Binding<MapPin?>) { self._selectedPin = selectedPin } func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) { guard let pin = view.annotation as? MapPin else { return } pin.action?() selectedPin = pin } func mapView(_ mapView: MKMapView,