Iphone 如何获得当前职位?

Iphone 如何获得当前职位?,iphone,api,geolocation,Iphone,Api,Geolocation,我被提供了这个地址,并被告知找到我的当前位置 http://maps.google.com/maps/geo?q=address&output=csv 这是什么样的地址?我怎样才能得到这方面的信息。这是API吗 请帮助602,0,0,0 这是你的位置坐标。根据谷歌地图,你可以在这里找到地址的经纬度。如果您请求此url并使用要查找坐标的地址,则得到4值作为响应。您可以使用此函数获取具有lat和地址日志的Location对象: -(CLLocationCoordinate2D) addre

我被提供了这个地址,并被告知找到我的当前位置

http://maps.google.com/maps/geo?q=address&output=csv
这是什么样的地址?我怎样才能得到这方面的信息。这是API吗

请帮助

602,0,0,0


这是你的位置坐标。根据谷歌地图,你可以在这里找到地址的经纬度。如果您请求此url并使用要查找坐标的地址,则得到4值作为响应。您可以使用此函数获取具有lat和地址日志的Location对象:

-(CLLocationCoordinate2D) addressLocation:(NSString *)address {
  NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", 
                [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
  NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
  NSArray *listItems = [locationString componentsSeparatedByString:@","];

  double latitude = 0.0;
  double longitude = 0.0;

  if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
    latitude = [[listItems objectAtIndex:2] doubleValue];
    longitude = [[listItems objectAtIndex:3] doubleValue];
  }
  else {
     //Show error
  }
  CLLocationCoordinate2D location;
  location.latitude = latitude;
  location.longitude = longitude;

  return location;
}
您可以在这里找到更多帮助:

假设您给出了,结果将是
200,4,40.7143528,-74.0059731。最后两个值表示纽约的纬度和经度值…我希望它能帮助您。如果您将此url集成到应用程序中,您可以获得坐标,并使用它们在iPhone的MKMapView中显示地图。

您如何知道OP的位置?:)地址位置上的无人键入ur地址,并以csv格式写入您想要的结果格式,如json等。OP=Original Poster=rajeshwhich是纬度,长在json格式的“点”:{“坐标”:[-119.9590257,36.2552300,0]}无论如何,这个地址36.2552300是纬度,-119.9590257是经度。在GMAP中: