您好 我从服务器“{\”bindings \“获得一个响应:[{\”Latitude \“:\”25.451808633333332 \“,\”经度\“:\”81.83372523333333 \“}]}”,它在数组中,我需要打破纬度和经度部分或值,并将值初始化为另一个字符串。
答案 0 :(得分:1)
NSString *latitudeString = [[[jsonDict objectForKey:@"bindings"]objectAtIndex:0]objectForKey:@"Latitude"];
NSString *longitudeString = [[[jsonDict objectForKey:@"bindings"]objectAtIndex:0]objectForKey:@"Longitude"];
以更好的方式:
NSDictionary *gealocationDict = [[jsonDict objectForKey:@"bindings"]objectAtIndex:0];
NSString *latitudeString = [gealocationDict objectForKey:@"Latitude"];
NSString *longitudeString = [gealocationDict bjectForKey:@"Longitude"];