lat lon を に変換したいCLLocationCoordinate2D
。
self.currentLocation = {.latitude = 0.0, .longitude = 0.0};
これにより、「期待される式」というエラーが表示されます。
私は何を間違っていますか?
lat lon を に変換したいCLLocationCoordinate2D
。
self.currentLocation = {.latitude = 0.0, .longitude = 0.0};
これにより、「期待される式」というエラーが表示されます。
私は何を間違っていますか?
CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude)
座標を作成するために使用します。
使えCLLocationCoordinate2DMake
ますが、iOS 4.0以降でしか使えないので注意が必要です。これを試して「手動で」作成できます。
CLLocationCoordinate coordinate;
coordinate.latitude = 0.0;
coordinate.longitude = 0.0;
self.currentLocation = coordinate;
あなたのコードは正しいようです。エラー/警告はスローされません。self.currentLocationがCLLocationCoordinate2Dであることを確認してください。以下のように式をキャストしてみてください。
self.currentLocation = (CLLocationCoordinate2D){.latitude = 0.0, .longitude = 0.0};
または、 CLLocationCoordinate2DMakeメソッドを使用することもできます。