扮演替身?
我怎样才能将某些东西变成双倍? CLLocationDegrees 实际上是一个双精度数,那么我如何将其转换为双精度数,以便我的 if 始终返回双精度数,并且我可以将 findAllLocalCountTotal 参数更改为双精度数而不是 CLLocationDegrees?
if(self.lastKnownLocation == nil ){
double lat = [CLController sharedInstance].latitude;
double lng = [CLController sharedInstance].longitude;
}else{
CLLocationDegrees lat = self.lastKnownLocation.coordinate.latitude;
CLLocationDegrees lng = self.lastKnownLocation.coordinate.longitude;
}
NSNumber *tempInt = self.lastPostsGrabbedCounter;
//Make call to get data with lat lng
self.webServiceAllCount = [Post findAllLocalCountTotal:(CLLocationDegrees)lat withLong:(CLLocationDegrees)lng];
How can I turn or maybe cast something to a double? CLLocationDegrees is really a double so how do I cast it as double so my if always returns doubles and I can change my findAllLocalCountTotal params to double instead of CLLocationDegrees?
if(self.lastKnownLocation == nil ){
double lat = [CLController sharedInstance].latitude;
double lng = [CLController sharedInstance].longitude;
}else{
CLLocationDegrees lat = self.lastKnownLocation.coordinate.latitude;
CLLocationDegrees lng = self.lastKnownLocation.coordinate.longitude;
}
NSNumber *tempInt = self.lastPostsGrabbedCounter;
//Make call to get data with lat lng
self.webServiceAllCount = [Post findAllLocalCountTotal:(CLLocationDegrees)lat withLong:(CLLocationDegrees)lng];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用强制转换并将变量声明移到
if
之外 -if
&else
分支是不同的作用域,并引入了自己的变量:Just use a cast and also move the variable declaration outside of the
if
- theif
&else
branches are distinct scopes and introduced their own variables:这个话题可以帮助你吗? cllocation Degrees
This topic can help you ? cllocationdegrees