簡體   English   中英

保留CLLocationpoints以進行解析然后檢索它們的最佳方法

[英]Best Way to persist CLLocationpoints to Parse and then retrieve them

在我的應用中,我正在跟蹤用戶的跑步情況,想想按照這些路線映射我的跑步情況或其他內容。 當用戶正在運行時,MKPolyline會跟蹤用戶的位置,當使用完成時,我需要做的運行部分就是保存“運行”以供其他人查看。 現在,MKPolyline由保存在數組中的CLLocation點組成

func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
for location in locations as! [CLLocation] {

if location.horizontalAccuracy < 20 {
  //update distance
  if self.locations.count > 0 {
    distance += location.distanceFromLocation(self.locations.last)
  }

  self.locations.append(location)
}
}
}

我正在尋找有關保存和檢索此“運行”以進行解析,然后進行檢索並將檢索到的數據顯示在地圖上的最佳實踐的建議。

您可以使用PFGeoPoints數組。

解析建議您在一個對象的數組屬性中不要存儲超過100個對象,因此,如果要存儲更多對象,則可以創建一個具有GeoPoint屬性和標識符的包裝器類,並使用查詢來檢索通過標識符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM