당신은 PFGeoPoint으로 변수를 만들고이 변수로 구문 분석에서 데이터를 넣을 수 있습니다 :
var latitude: CLLocationDegrees = descLocation.latitude
var longtitude: CLLocationDegrees = descLocation.longitude
var location: CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: latitude, longitude: longtitude)
: 단지이 줄을 추가
var descLocation: PFGeoPoint = PFGeoPoint()
var innerP1 = NSPredicate(format: "ObjectID = %@", objectID)
var innerQ1:PFQuery = PFQuery(className: "Test", predicate: innerP1)
var query = PFQuery.orQueryWithSubqueries([innerQ1])
query.addAscendingOrder("createdAt")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {
for object in objects {
descLocation = object["GeoPoint"] as PFGeoPoint
}
} else {
println("Error")
}
}
그리고 당신은 위치를 필요 클래스에
그래서 당신은이 코드를 사용하여지도에 주석을 추가 할 수 있습니다 : 당신이 네가 윌리엄 이니를 수행하기 위해 사용하는 어떤 코드
@IBOutlet var map: MKMapView!
var annotation = MKPointAnnotation()
annotation.title = "Test"
annotation.coordinate = location
map.addAnnotation(annotation)
와이? "위치를 묻는 데 문제가 있습니다"라는 의미는 무엇입니까? 어떤 문제가 있습니까? –
다음 코드를 사용하고 있습니다 : var query = PFUser.query() 그런 다음 query.whereKey. 필자는 Locations를 구문 분석에서 쿼리하고 CLLocation으로 변환하여 맵에서 주석으로 사용할 수있는 방법을 모르겠습니다. –
DB에서 특정 위치 근처의 위치를 쿼리하고 찾으려고합니까? –