0
我的問題是,當我從locationManager獲取位置時,它有時無法正確加載。所以我想檢查我的位置是否不同於0.0000000。爲此,我將座標轉換爲字符串。然後將該字符串與isEaqual進行比較。如何將位置的緯度與字符串進行比較
NSMutableString *[email protected]"0.0000000";
while(true){
cLoc=appDelegate.currentLocaiton;
lat=[NSString stringWithFormat:@"%f", [cLoc coordinate].latitude];
lng=[NSString stringWithFormat:@"%f", [cLoc coordinate].longitude];
NSLog(@"Execution Time: %f lat: %p lng: %p", executionTime, lat, lng);
NSLog(lat);
NSLog(lng);
NSLog(nicla);
if([lat isEqual:nicla]){ }
else break;
}
我也tryied isEaqualToString但同樣的結果,在我的日誌那些identicaly串...
tenx爲這個想法它現在的作品,我不知道我在想什麼,但仍然爲什麼不會比較兩個字符串? – gabrjan
聲明NSMutableString * nicla = @「0」&use lat = [NSString stringWithFormat:@「%d」,(int)[cLoc coordinate] .latitude]]; – Rams