objective c frustrate me whats with pointers?
I know my issue has to do with pointers (obj-c noob), but how can go about getting this, which I know is wrong.
double *lat = self.lastKnownLocation.coordinate.latitude;
double *lng = self.lastKnownLocation.coordinate.longitude;
Get an error using suggestions below when I try to use this "Expected ) before CLLocationDegress"
+ (NSMutableArray *)findNextTwentyFiveRemo开发者_运维知识库te:(CLLocationDegrees *)latitude withLong: (CLLocationDegrees *)longitude withLastIncrementNum:(int *)lastPostIdAsString;
If you just want the latitude and longitude properties, then all you need to do is drop the pointer declaration:
double lat = self.lastKnownLocation.coordinate.latitude;
double lng = self.lastKnownLocation.coordinate.longitude;
Since latitude
and longitude
are just doubles, not pointers of any kind (they're not objects), you don't declare the variable storing them as a pointer.
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 );
精彩评论