i want to Read the Geolocation from the Parse Database and show the Location from another Users in the Map.
I Write the Location to the parse Database :
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
if (!error) {
[[PFUser currentUser] setObject:geoPoint forKey:@"currentLocation"];
[[PFUser currentUser] saveInBackground];
And then i read the Usernames and the Locations
PFQuery *User = [PFUser query];
[User selectKeys:@[@"username"]];
[User findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
Name = results;
}];
PFQuery *Location = [PFUser query];
[Location selectKeys:@[@"currentLocation",]];
[Location findObjectsInBackgroundWithBlock:^(NSArray *location, NSError *error)
{
Coordinaten = location;
}];
NSLog(@" %@ hat die %@",Name , Coordinaten);
// ann.title = [Name objectAtIndex:1] ;
// ann.coordinate = [[Coordinaten objectAtIndex:1] coordinate];
// [MapView addAnnotation:ann];
The first Problem is, the NSLog
show nothing . When I copy the NSLog
under the Coordinaten = Location
, they show me only the Values for Coordinaten. Under Name = results
only the Names .
NSArray
Coordinaten / Names are decelerated in the .h
The Next thing is, how i set the title and the coordinate with these NSArrays
// ann.title = [Name objectAtIndex:1] ;
// ann.coordinate = [[Coordinaten objectAtIndex:1] coordinate];
// [MapView addAnnotation:ann];
Thanks!