2014-05-21 6 views
1

문제가 있으며 해결 방법을 찾을 수 없습니다. 이CLLocationCoordinate2DMake 유형 지정자가 누락되었습니다.

CLLocationCoordinate2D coord[12]; 
coord[0] = CLLocationCoordinate2DMake(52.5041,13.351); 

그것은 말한다처럼

내 코드는 같습니다

유형 지정은 기본적으로 내가 왜하지 않는 'INT'

에 누락. 나는 다른 생각을 시도하고 심지어이 페이지에서 비슷한 코드를 보았을 때, 내가 힌트를 찾고 있었을 때. 문서에 따르면 GZ 아드리안

답변

0

:

CLLocationCoordinate2D CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude) 

그리고

typedef double CLLocationDegrees; 

당신이 CLLocationCoordinate2DMake(52.5041,13.351);52.504113.351이 어쩌면 이중으로 간주되지 않습니다 쓰기

.

는 다음과 같이하십시오 :

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc]init]; 
[numberFormatter setNumberStyle:kCFNumberFormatterDecimalStyle]; 
NSNumber *lat = [numberFormatter numberFromString:@"52.5041"]; 
NSNumber *lng = [numberFormatter numberFromString:@"13.351"]; 
coord[0] = CLLocationCoordinate2DMake(lat,lng); 
+0

을이 12 diffrenet 좌표. 거기에 더 좋은 방법이 아닌가요? – DaPole

+0

12 개의 서로 다른 좌표를 반복하면 변수는'double'이되는'String'이됩니다. – BriceB

+0

나는 너무 바보 같아서 ... 그것은 내 헤더 파일에서 시도했기 때문에 작동하지 않았다. 이제 locationManager에 넣으면 작동합니다 (두 번째 줄) – DaPole

관련 문제