Objective c 目标c挫败我,指针是什么?

Objective c 目标c挫败我,指针是什么?,objective-c,pointers,Objective C,Pointers,我知道我的问题与指针(obj-cnoob)有关,但我知道这是错误的,如何才能得到它呢 double *lat = self.lastKnownLocation.coordinate.latitude; double *lng = self.lastKnownLocation.coordinate.longitude; 当我尝试在CLLocationDegress之前使用此“预期”)时,使用下面的建议得到一个错误 如果只需要纬度和经度属性,则只需删除指针声明: double lat = self

我知道我的问题与指针(obj-cnoob)有关,但我知道这是错误的,如何才能得到它呢

double *lat = self.lastKnownLocation.coordinate.latitude;
double *lng = self.lastKnownLocation.coordinate.longitude;
当我尝试在CLLocationDegress之前使用此“预期”)时,使用下面的建议得到一个错误


如果只需要纬度和经度属性,则只需删除指针声明:

double lat = self.lastKnownLocation.coordinate.latitude;
double lng = self.lastKnownLocation.coordinate.longitude;

由于
纬度
经度
只是双倍的,不是任何类型的指针(它们不是对象),因此您不需要将存储它们的变量声明为指针。

不清楚您想要做什么。重要的是,现在还不清楚你为什么想要一个指向双精度的指针。就是这样,我不知道我正在尝试将lat和lng设置为双精度,以便我可以在函数中使用它们。你能给出完整的函数调用和错误吗?还有,你为什么用纬度和经度来代替纬度和经度?也许我只是有点暴躁,但真的?跨两行的双变量初始化,这样您就可以避免在CLLocationDegress之前键入
double
twitter?预期)。当我尝试使用它时+(NSMutableArray*)查找DNextTwentyFiveremote:(CLLocationDegrees*)纬度with long:(CLLocationDegrees*)经度with lastIncrementNum:(int*)lastPostIdAsString;我隐约感觉到您的问题不在于
lat
lng
,而在于该函数的声明(或以前的一些代码)。你能多发一些它来自的文件吗?另外,您确定要根据需要包括MapKit标头吗?
double lat = self.lastKnownLocation.coordinate.latitude,
       lng = self.lastKnownLocation.coordinate.longitude;

// Later, when you want double pointers for some reason...
function_that_takes_double_pointers( & lat, & lng );
double lat = self.lastKnownLocation.coordinate.latitude;
double lng = self.lastKnownLocation.coordinate.longitude;