그래서 나는 parse.com에 여러 개체를 가지고 있습니다. 클래스 이름은 geoPoint라는 열에 지리적 포인트가있는 "MainInfo"입니다. 롤링 queryForTable내 쿼리가 작동하지 않는 이유를 이해할 수 없습니다.
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
if (!error) {
self.userLocation = geoPoint;
[self loadObjects];
}
}];
및 공연 :
@property (nonatomic, strong) PFGeoPoint *userLocation;
는 그 다음의 viewDidLoad에 다음과 같은 추가 :
나는 내 .H 파일에 다음을 추가하여 사용자의 위치를 얻고있다
- (PFQuery *)queryForTable
{
// User's location
PFGeoPoint *userGeoPoint = self.userLocation;
// Create a query for places
PFQuery *query = [PFQuery queryWithClassName:@"MainInfo"];
// Interested in locations near user.
[query whereKey:@"geoPoint" nearGeoPoint:userGeoPoint];
// Limit what could be a lot of points.
query.limit = 10;
// Final list of objects
_placesObjects = [query findObjects];
return query;
}
Xcode가 오류 *** setObjectForKey: object cannot be nil (key: $nearSphere)
내가 제대로 작동하는지 확인하기 위해 내가 뭘 잘못하고 있는지 전혀 알지 못합니다.
나는 이것을 파서 문서와 함께 사용하여 지금까지이 문제를 해결했다. Here is a link
'self.userLocation'은 (는) 시간에 업데이트 되었습니까? – Wain
@Wain 아니요 업데이트되지 않았습니다. 어떻게 사용자 위치를 찾을 때까지 쿼리를 대기시킬 수 있습니까? – Shayno