ユーザーの現在の場所が他の場所と同じかどうかに合わせたいと思います。ユーザーの現在地とその他の座標を取得する方法は同じですか?
マイロジック:
point.coordinate = coordinate
let userLat = mapView.userLocation?.coordinate.latitude
let userLong = mapView.userLocation?.coordinate.longitude
if point.coordinate.latitude == userLat && point.coordinate.longitude == userLong
{
point.title = "You are here"
}
else
{
point.title = "\(coordinate.latitude), \(coordinate.longitude)"
}
しかしprobelmはmapView.userLocation?.coordinate.latitude
がpoint.coordinate.latitude
と等しくない、ということです。しかし、私はシミュレータと他のcooridinateのuserLocationに同じ値を設定しています。私は、ユーザーの場所の設定をしています
値は以下のとおりです。 緯度:28.6 ロング:77.35
私は他の座標の設定をしています値は以下のとおりです。 緯度:28.6 ロング:77.35
私はユーザーの所在地を取得しています: 緯度:任意 - 一部:3.4028234663852886e + 38
ロング:▿オプション - 一部:私は他の座標のために取得しています3.4028234663852886e + 38
値は次のとおりです。 緯度:28.6 ロング:77.35
とに任意のより良いロジックがある場合このことを見つけて、教えてください。