clplacemark

Extending CLPlacemark results in EXC BAD ACCESS

心不动则不痛 提交于 2020-01-30 06:48:27
问题 Though there is a similar question found here it does not provide an answer, at least not for the general problem. My problem is: Since CoreLocation geocoding is rate limited and the (web-)service I am developing an app for provides its own fallback geocoding service, I want to use this custom geocoding service in case I reach Apple's rate limit. Furthermore, I feel it makes total sense to avoid a custom data type for results returned by this custom REST API and therefore would like to use

Extending CLPlacemark results in EXC BAD ACCESS

南楼画角 提交于 2020-01-30 06:48:08
问题 Though there is a similar question found here it does not provide an answer, at least not for the general problem. My problem is: Since CoreLocation geocoding is rate limited and the (web-)service I am developing an app for provides its own fallback geocoding service, I want to use this custom geocoding service in case I reach Apple's rate limit. Furthermore, I feel it makes total sense to avoid a custom data type for results returned by this custom REST API and therefore would like to use

Looking for business name information from coordinates using CLLocation and/or Mapkit

ぃ、小莉子 提交于 2020-01-03 06:21:05
问题 I'm trying to use coordinates returned using CLLocationManager to see if they are a close match for any local business - if I happened to be standing in a Starbucks for example, I would want my app to suggest that based on my coordinates I was standing in Starbucks. If I was 20 metres outside Starbucks, but it was the closest address to where I was standing, I would want it to suggest 'Starbucks'. I can return CLPlacemarks no problem, but the information they contain does not contain the

Convert coordinates to City name?

不羁岁月 提交于 2019-12-17 15:21:49
问题 How to get an address from coordinates using MapKit? I have this code when long press on the map it gets the coordinates: func didLongPressMap(sender: UILongPressGestureRecognizer) { if sender.state == UIGestureRecognizerState.Began { let touchPoint = sender.locationInView(self.mapView) let touchCoordinate = self.mapView.convertPoint(touchPoint, toCoordinateFromView: self.mapView) var annotation = MKPointAnnotation() annotation.coordinate = touchCoordinate annotation.title = "Your position"

can't figure out how to embed my current location in message body correctly using CLPlacemark

烈酒焚心 提交于 2019-12-11 09:39:55
问题 I had hardly tried few days ago to embed my current location in Message body on my iPhone, but I failed. I tried all I have in my mind, but I only got errors Last error I got is "fatal error: unexpectedly found nil while unwrapping an Optional value" I created an object of CLPlacemark and I made it optional, which means it could have value or could have nil. is there any way to create a message with my current location ? MainMenu file import UIKit import Social import MessageUI import

CLPlacemark crash in Swift

*爱你&永不变心* 提交于 2019-12-11 03:22:19
问题 I'm using CLGeocoder for reverse geolocation and get array of CLPlacemark . When I use GPS outside the US (i.e. -27,127) and then access placemark.postalCode , the app crashes with: "fatal error: unexpectedly found nil while unwrapping an Optional value". It seems, that placemark.postalCode is nil where no postal code is available. But postalCode return type in Swift is String! : var postalCode: String! { get } // zip code, eg. 95014 So I can't even test is for nil , because the crash is

Convert coordinates to City name?

旧巷老猫 提交于 2019-11-27 17:23:34
How to get an address from coordinates using MapKit? I have this code when long press on the map it gets the coordinates: func didLongPressMap(sender: UILongPressGestureRecognizer) { if sender.state == UIGestureRecognizerState.Began { let touchPoint = sender.locationInView(self.mapView) let touchCoordinate = self.mapView.convertPoint(touchPoint, toCoordinateFromView: self.mapView) var annotation = MKPointAnnotation() annotation.coordinate = touchCoordinate annotation.title = "Your position" self.mapView.addAnnotation(annotation) //drops the pin println("lat: \(touchCoordinate.latitude)") var