CLLocationCoordinate2Dを使用しているユーザーの現在の場所を取得しようとしています。値を書式のようにしたいCLLocationCoordinate2Dを使用して現在の場所を取得
CLLocationCoordinate2D start = {-28.078694,153.382844};
私は次のようにそれらを使用できるように:
NSString *urlAddress = [NSString
stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f",
start.latitude, start.longitude,
destination.latitude, destination.longitude];
を私は長い&緯度現在取得する
CLLocation *location = [[CLLocation alloc]init ];
CLLocationDegrees currentLatitude = location.coordinate.latitude;
CLLocationDegrees currentLongitude = location.coordinate.longitude;
を使用。
しかし、テストしようとすると両方とも0.000になっています。私はiPhone 4でテストしています。
サンプルコードがあれば、それは素晴らしいでしょう。
あなたは 'MKMapView'を使用していますか? –
どのように座標を取得していますか?これまでに試したことのコードを追加してください。 – deanWombourne
CLLocation * location = [[CLLocation alloc] init]を使用しています。 CLLocationDegrees currentLatitude = location.coordinate.latitude; CLLocationDegrees currentLongitude = location.coordinate.longitude; – iOSDev