2013-04-10 39 views
4

該主題說明了一切。爲什麼我在這2行中得到這個錯誤信息?CLLocation表示不兼容類型的表達式'雙'

NSArray *coordinates = [locationDetails[@"coordinates"] componentsSeparatedByString:@","]; 
CLLocationDegrees *lat = [coordinates[1] doubleValue]; //here is the red arrow <---- 

,準確地將顯示如下消息:

初始化 'CLLocationDegrees *'(也作 'double *')與不兼容的類型的一個表達式 '雙'

回答

9

更改這:

CLLocationDegrees *lat = [coordinates[1] doubleValue]; 

CLLocationDegrees lat = [coordinates[1] doubleValue]; 

擺脫星號。 CLLocationDegrees不是類,它是double(基本類型)的typedef。

+0

+1比我快:) – 2013-04-10 16:33:43

+0

哇我facepalm我的自我。這個'*'偷了我約30分鐘。 – CTSchmidt 2013-04-10 16:36:07