簡體   English   中英

如何發送坐標進行解析並將其保存為解析PFGeopoint

[英]how can I send coordinates to parse and save it as parse PFGeopoint

如何將坐標發送到CLLocation提取的Parse並將其保存為PFGeoPoint的緯度和經度?

我能夠從CLLocation獲取坐標,我想將它發送給Parse。 在Parse中,我有一個名為“坐標”的列,類型為PFGeoPoint,它有兩個字段。現在我想保存從CLLocation到Parse Column坐標的坐標。 有人可以幫我這個嗎? 我是iOS和Parse的新手。

兩個步驟:

  1. 將CLLocation轉換為PFGeoPoint

     //SWIFT let point = PFGeoPoint(location: currentLoc) //Obj-c [PFGeoPoint *point = PFGeoPoint geoPointWithLocation:(PF_NULLABLE CLLocation *)location]; 
  2. 現在保存吧。

     //SWIFT object["coordinates"] = point object.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in if (success) { // The object has been saved. } else { // There was a problem, check error.description } } //Obj-c object["coordinates"] = point; [object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { if (succeeded) { // The object has been saved. } else { // There was a problem, check error.description } }]; 

暫無
暫無

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

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