내 코드에서 API를 구문 분석 할 때 __NSSingleObjectArrayI에 nil이있는 것과 같은 오류가 발생했지만 배열에 값이 있습니다. iOS에서 JSON 구문 분석시 NSSingleObjectArrayI 오류가 발생합니까?
는 여기에 코드의 내 부 ..latitudeArray = [monumentArray valueForKey:@"lat"];
NSLog(@"latitudeArray is %@",latitudeArray);
longitudeArray = [monumentArray valueForKey:@"lng"];
NSLog(@"longitudeArray is %@",longitudeArray);
for (int i = 0; i<3; i++) {
CLLocation *locationA = [[CLLocation alloc] initWithLatitude:[latStr doubleValue] longitude:[longStr doubleValue]];
CLLocation *locationB = [[CLLocation alloc] initWithLatitude:[[latitudeArray objectAtIndex:i] doubleValue] longitude:[[longitudeArray objectAtIndex:i] doubleValue]]; ----------> This Line I Got The Crash Error..
CLLocationDistance distanceInMeters = [locationA distanceFromLocation:locationB];
NSLog(@"distanceInMeters is %f",distanceInMeters);
float i = distanceInMeters/1000;
NSLog(@"distance between two places is %f KM", i);
//[locationDistances addObject:distanceInMeters];
}
NSSingleObjectArrayI의 의미는 무엇인가를 준?
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
해결 방법을 알려주십시오. latitudeArray이 값이
...
latitudeArray is (
(
(
(
(
"27.000",
"27.1798189999",
"27.1928780000"
)
)
)
)
)
이 배열을 tableview에서 사용하셨습니까? – KKRocks
아니요, API에서 응답을 받았고 배열에 저장되어 있습니다. @ KKRocks –
어떤 코드를 보여 주시겠습니까? 충돌 결과는 무엇입니까? – dirtydanee