2013-05-13 6 views
0

3 내가 JSON 피드에서 데이터를 가져 오기 위해 노력하고 있습니다. 피드 URL은 정확한 좌표가되도록 프로그램에서 편집해야합니다. 하지만 오류가 점점 계속 : 그래서 인수를 기대하지 않습니다너무 많은 인수,

NSString *lat = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.latitude]; 
latitude.text = lat; 

NSString *lng = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.longitude]; 
longitude.text = lng; 

NSString *acc = [[NSString alloc] initWithFormat:@"%g", newLocation.horizontalAccuracy]; 
accuracy.text = acc; 

// 

NSURLRequest *theRequest = [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://api.wunderground.com/api/595007cb79ada1b1/geolookup/q/%@,%@.json", lat, lng]]; 

감사합니다, 댄

답변

4

URLWithString는 형식 문자열을 기대하지 않는 lng : 여기

Too many arguments to method call, expected 1, have 3

내 코드입니다 및 lat

는 AF를 사용하는 생성자를 사용하여 다른 곳에서 먼저 해당 문자열을 만들어보십시오 ormat 문자열 :

NSString *urlString = [NSString stringWithFormat: @"http://api.wunderground.com/api/595007cb79ada1b1/geolookup/q/%@,%@.json", lat, lng]; 
NSURLRequest *theRequest = [NSURLRequest requestWithURL: [NSURL URLWithString:urlString]] 
+0

잘못된 점에 대한 코드 및 설명에 대해 감사드립니다. 매우 도움이 참으로 :) – Supertecnoboff

관련 문제