-3
我正在做一個應用程序,用戶可以在地圖上選擇建築物並將它們保存在列表中。一切都很好,但我需要在應用程序關閉後保存用戶選擇。如何爲iOS應用程序創建永久存儲?
func action(_ gestureRecognizer:UIGestureRecognizer) { // GESTURE RECOGNIZER FUNCTION
if gestureRecognizer.state == UIGestureRecognizerState.began {
let touchPoint = gestureRecognizer.location(in: self.map)
let newCoordinate = self.map.convert(touchPoint, toCoordinateFrom: self.map)
let location = CLLocation(latitude: newCoordinate.latitude, longitude: newCoordinate.longitude)
CLGeocoder().reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in
var title = ""
if (error == nil) {
if let p = placemarks?[0] {
var subThoroughfare:String = ""
var thoroughfare:String = ""
if p.subThoroughfare != nil {
subThoroughfare = p.subThoroughfare!
}
if p.thoroughfare != nil {
thoroughfare = p.thoroughfare!
}
歡迎堆棧溢出!您可以參考[遊覽](http://stackoverflow.com/tour)並學習[如何問](http://stackoverflow.com/help/how-to-ask)一個很好的問題,並創建一個[Minimal ,完整和可驗證示例](http://stackoverflow.com/help/mcve)。這使我們更容易幫助你。 – Starlord