私はhttp://www.switchonthecode.com/tutorials/getting-your-location-in-an-iphone-applicationチュートリアルに従っていますが、私のXcode SDKで緯度と経度を取得できません。緯度経度IOS 4.3
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
int degrees = newLocation.coordinate.latitude;
double decimal = fabs(newLocation.coordinate.latitude - degrees);
int minutes = decimal * 60;
double seconds = decimal * 3600 - minutes * 60;
NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"",
degrees, minutes, seconds];
//latLabel.text = lat;
degrees = newLocation.coordinate.longitude;
decimal = fabs(newLocation.coordinate.longitude - degrees);
minutes = decimal * 60;
seconds = decimal * 3600 - minutes * 60;
NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"",
degrees, minutes, seconds];
NSLog(@"%@ %@",longt, lat);
}
コンソールには緯度と経度が表示されません。 お願いします。
:ここ
は、この方法のための一例ですデリゲートメソッド 'locationManager:didFailWithError:'を実装していますか?もしそうなら、エラーはありますか?そうでない場合は、実装してエラーがあるかどうかを確認してください。 – mattjgalloway
コードは私のためにバットのまっすぐに動作します。単一のビューアプリケーションで。あなたの現在の場所を使用するように求められたら、[OK]をクリックしましたか? – markhunte
ああ、私はiOS5を使用していたことを認識しました。あなたは取得しています:サーバーはクライアントの登録を受け付けませんでした68.コンソールで – markhunte