【发布时间】:2013-11-24 22:04:08
【问题描述】:
我想从 Parse 数据库中读取地理位置并在地图中显示其他用户的位置。
我将位置写入解析数据库:
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
if (!error) {
[[PFUser currentUser] setObject:geoPoint forKey:@"currentLocation"];
[[PFUser currentUser] saveInBackground];
然后我阅读了用户名和位置
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];
第一个问题是,NSLog 什么都不显示。当我在 Coordinaten = Location 下复制 NSLog 时,它们只显示 Coordinaten 的值。在 Name = results 下只有 Names 。
NSArray Coordinaten / 名称在 .h 中减速
接下来是,我如何用这些 NSArrays 设置标题和坐标
// ann.title = [Name objectAtIndex:1] ;
// ann.coordinate = [[Coordinaten objectAtIndex:1] coordinate];
// [MapView addAnnotation:ann];
谢谢!
【问题讨论】:
标签: ios geolocation parse-platform geopoints