【发布时间】:2014-12-17 10:26:21
【问题描述】:
所以我使用 parse 从该查询中获取用户位置和数据的更新,如下所示:
-(void) getUserLocationAndData:(BOOL) showProgress
{
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error)
{
if (!error)
{
NSLog(@"Got current location - Zooming Map!");
CLLocationCoordinate2D zoomLocation;
zoomLocation.latitude = geoPoint.latitude;
zoomLocation.longitude = geoPoint.longitude;
[self getNearByData:geoPoint];
}
else
{
[[[UIAlertView alloc] initWithTitle:@"Unable to get Current Location" message:@"This app needs your current location in order to locate near by data. Please check your internet connection and make sure you enabled access to the location information." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
}
}];
}
当应用首次启动时,用户位置会显示出来,数据会被提取并且一切正常。如果您等待大约 15 秒并且不移动用户位置图标将变为灰色(见图)并且任何更新都会导致失败。如果我重新加载视图,它会再次工作,但会发生同样的事情。
我没有使用 CLLocationManager,因为我不需要不断地将数据拉到用户附近。只是每隔一段时间或根据用户的要求。
我还注意到,如果我等待足够长的时间,用户位置会再次变为蓝色,并且似乎一切正常。是什么导致此超时?我可以设置这个超时,还是只需要使用 CLLocationManager 来控制它? Parse 是否只是因内部 CLLocationManager 或其他原因而超时?
感谢您的帮助!
【问题讨论】:
标签: ios parse-platform mkmapview cllocationmanager cllocation