iPad 용으로 개발하여 Coordinates.geojson이라고하는 파일을 만들었습니다. 난에서이 값을 retreive 수있는 방법iOS : geojson iOS 액세스
{
"shelf1": {
"name": "six.png",
"coordinates": [
[
14,
25,
329,
138
],
[
14,
185,
329,
138
],
[
14,
344,
158,
138
],
[
185,
344,
158,
138
],
[
14,
94,
158,
138
],
[
185,
500,
158,
138
]
]
}
}
: 나는 여기
JsonDecoder.m
라는 클래스 파일 내에서 액세스하려는 JsonDecoder.m@implementation JsonDecoder
- (id)initWithJson
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Coordinates" ofType:@"geojson"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSError *error;
_json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
return self;
}
- (NSArray*) getCoordinatesFromShelf:(NSString *) bookShelfName
{
NSArray *coordinates = [[[_json objectForKey:@"shelf1"] objectForKey:@"coordinates"]objectAtIndex:1];
for(id i in coordinates)
NSLog(@"%@",i);
return coordinates;
}
@end
그리고 내 Coordinates.geojson입니다 클래스 파일에서?
감사합니다. 아이폰 OS에서
그래서 내 편집을 참조하십시오. – Eyeball
2013-04-26 06 : 51 : 24.515 skattkistan [1580 : c07] *** 캐치되지 않은 예외 'NSInvalidArgumentException'으로 인해 앱이 종료 됨, 이유 : '데이터 매개 변수가 있습니다. 없음 ' *** – Eyeball