나는 이와 같은 데이터베이스에 데이터를 가지고 있습니다.배열로 배열을 가져 오지만 배열에 배열이됩니다.
["{37.331622, -122.030337}","{37.331593, -122.03051}","{37.331554, -122.030681}","{37.331383, -122.030757}","{37.33108, -122.030772}","{37.330798, -122.030729}","{37.330636, -122.030636}"]
다음 코드를 사용하여 데이터베이스에서 데이터를 쿼리하려고합니다.
- (void)updateLocations {
CGFloat kilometers = self.radius/1000.0f;
//PFUser *user = [PFUser currentUser];
PFQuery *query = [PFQuery queryWithClassName:@"Session"];
[query whereKey:@"objectId" equalTo:@"t2udAri048"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(@"objects %@",objects);
NSLog(@"path %@",[objects valueForKey:@"Path"]);
NSArray *pointsArray = [objects valueForKey:@"Path"];;
NSInteger pointsCount = pointsArray.count;
CLLocationCoordinate2D pointsToUse[pointsCount];
for(int i = 0; i < pointsCount; i++) {
CGPoint p = CGPointFromString(pointsArray[i]);
pointsToUse[i] = CLLocationCoordinate2DMake(p.x,p.y);
}
MKPolyline *myPolyline = [MKPolyline polylineWithCoordinates:pointsToUse count:pointsCount];
[self.mapView addOverlay:myPolyline];
//NSLog(@"Drawed %@",pointsArray);
}
}];
}
나는의 값이 [valueForKey 객체 : @ "경로"] 얻을
( ( "{37.331622, -122.030337}", "{37.331593, -122.03051}"을, "{37.331554, -122.030681}" "{37.331383, -122.030757}" "{37.33108, -122.030772}" "{37.330798, -122.030729}" "{37.330636, -122.030636}" ))
하지만 난 그것에
( 을 원한다 "{37.331622, -122.030337}", "{37.331593, -122.03051}", "{37.331554, -122.030681}", "{ 37.331383, -122.030757} ", "{37.33108, -122.030772} ", "{37.330798, -122.030729} ", 는"{37.330636, -122.030636} " )
내가 무엇을해야합니까? objects
의 "경로" 속성 목적 한 소자의 배열 것처럼
Martin R. 고맙습니다. – user3504542