2

I am building an application that stores locations in a list and later maps them.

The problem I'm running into is an inability to save MKMapItems to a Parse database. I need to save these MKMapItems because they are the only unique identifiers for locations on a map that would not require searching the map again (ex.location name, ex. address).

So my question is, how can I save an MKMapItem to a Parse database?

And to follow up, if it is not possible to save an MKMapItem, how else can I save these items to a map so that I do not have to re-search?

MKMapItem: https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapItem_class/Reference/Reference.html

Parse: https://www.parse.com/docs/ios_guide#top/iOS

EDIT

Another detail that might help: I'm using this to store information about particular venues. For example restaurants. I don't necessarily want to be creating a new map annotations at that mark if I can avoid it.

4

1 回答 1

1

我不确定 Parse 是否有预建的支持,但你绝对可以创建自己的类来做到这一点:

1)您可以使用此 init 方法MKMapItem从 an创建一个MKPlacemark

- (id)initWithPlacemark:(MKPlacemark *)placemark

2)MKPlacemark基本上只是一个坐标和地址,使用这个init方法创建

- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary

CLLocationCoordinate2D可以很容易地存储在 Parse 上的自定义类中。如果您关心,您也可以存储相关的地址值。

3) 当你需要获取MKMapItems 时,实际上是获取底层MKPlacemark坐标,创建MKPlacemarks,最后MKMapItem使用 each 创建 s。

于 2014-03-29T00:09:33.273 回答