あなたの GPS 位置を正常に検出するアプリがありますが、その GPS と GPS 位置のリストを比較できるようにする必要があります。両方が同じであれば、ボーナスが得られます。
私はそれが機能していると思っていましたが、そうではないようです。
あなたがいる場所として「newLocation」があります。問題は、newLocation の経度データと緯度データを分離できる必要があることだと思います。
これまでのところ、これを試しました:
NSString *latitudeVar = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.latitude];
NSString *longitudeVar = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.longitude];
GPS ロケーションのリストの例:
location:(CLLocation*)newLocation;
CLLocationCoordinate2D bonusOne;
bonusOne.latitude = 37.331689;
bonusOne.longitude = -122.030731;
その後
if (latitudeVar == bonusOne.latitude && longitudeVar == bonusOne.longitude) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"infinite loop firday" message:@"infloop" delegate:nil cancelButtonTitle:@"Stinky" otherButtonTitles:nil ];
[alert show];
[alert release];
}
これにより、「invalid operands to binary == have strut NSstring and CLlocationDegrees」というエラーが発生します
何かご意見は?