Ios 如何根据下面显示的url中的用户位置更新纬度和经度值?

Ios 如何根据下面显示的url中的用户位置更新纬度和经度值?,ios,Ios,喜欢 步骤1 最初使用didUpdateLocations方法获取更新位置 获得更新的位置后,将数据发送到服务器 获取当前位置纬度和经度,然后替换url中的该值。选中链接以查找用户的当前位置 -(void)startParsing { xmlParser=[[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/xml?lo

喜欢

步骤1

最初使用
didUpdateLocations
方法获取更新位置

获得更新的位置后,将数据发送到服务器


获取当前位置纬度和经度,然后替换url中的该值。选中链接以查找用户的当前位置
-(void)startParsing

{
xmlParser=[[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/xml?location=17.4297757,78.4294033&radius=500&types=restaurant&sensor=false&key=AIzaSyB2R3W5-MXd74CNVRGU30As4_Hypuq2Ysw"]];
[xmlParser setDelegate:self];
[xmlParser parse];

}
// Location Manager Delegate Methods    
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"%@", [locations lastObject]);
[manager stopUpdatingLocations];
 CLLocation *currentLocation = [locations lastObject];

NSString *lat = [NSString stringWithFormat:@"%.2f", currentLocation.coordinate.latitude];
NSString *lon = [NSString stringWithFormat:@"%.2f", currentLocation.coordinate.longitude];
  [self startParsing:lat longi:lon];
}
 -(void)startParsing:(NSString *)lati longi:(NSString *)longa
{
   NSString *stringofNewLocation=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/xml?location=%@,%@&radius=500&types=restaurant&sensor=false&key=AIzaSyB2R3W5-MXd74CNVRGU30As4_Hypuq2Ysw",lati,longa];
xmlParser=[[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:stringofNewLocation]];
[xmlParser setDelegate:self];
[xmlParser parse];

}