5
我想知道如何將CLLocationCoordinate2D的緯度和經度值轉換爲數字或字符串值。 艾弗嘗試了幾種不同的方法,但他們arene't工作:將CLLocationCoordinate2D類型轉換爲數字或字符串
CLLocationCoordinate2D centerCoord;
centerCoord.latitude = self.locModel.userLocation.coordinate.latitude ;
centerCoord.longitude = self.locModel.userLocation.coordinate.longitude;
NSString *tmpLat = [[NSString alloc] initWithFormat:@"%g", centerCoord.latitude];
NSString *tmpLong = [[NSString alloc] initWithFormat:@"%g", centerCoord.longitude];
NSLog("User's latitude is: %@", tmpLat);
NSLog("User's longitude is: %@", tmpLong);
這將返回由編譯器警告。
的警告
warning: passing argument 1 of 'NSLog' from incompatible pointer type
我該怎麼辦呢?
任何幫助,將不勝感激。
感謝
對不起,安娜卡列尼娜,關於混亂。我更新了我的問題信息並添加了警告。請參閱上面的 謝謝 – banditKing
問題的確是你沒有在NSLog字符串前面的@符號。 – Anna