Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGFloat Incompatible types in initialization

Anyone see the issue here?

double latDouble = [latString doubleValue];
double lngDouble = [lngString doubleValue];

CGFloat dist = [self calcDiffDistance:latDouble withPostLng:lngDouble]; // Incompatible types in initialization

- (float)calcDiffDistance:(double)postLat withPostLng:(double)lon1
{
    ...
}
like image 349
jdog Avatar asked Sep 05 '26 03:09

jdog


1 Answers

The typedef for CGFloat is double on a 64-bit system, and float on a 32-bit system. My guess is you're compiling on a 64-bit system, and are assigning a float return value to a double variable.

like image 173
Shaggy Frog Avatar answered Sep 08 '26 02:09

Shaggy Frog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!