Iphone NSArray用于中断信息的帮助
嗨 我从服务器“{\”bindings\”:[{\“Latitude\”:“25.451808633333332\,“Longitude\”:“81.83372523333333\”}]得到一个响应,它在数组中,我需要将纬度和经度部分或值打断,并将值初始化为另一个字符串Iphone NSArray用于中断信息的帮助,iphone,json,nsarray,Iphone,Json,Nsarray,嗨 我从服务器“{\”bindings\”:[{\“Latitude\”:“25.451808633333332\,“Longitude\”:“81.83372523333333\”}]得到一个响应,它在数组中,我需要将纬度和经度部分或值打断,并将值初始化为另一个字符串 NSString *latitudeString = [[[jsonDict objectForKey:@"bindings"]objectAtIndex:0]objectForKey:@"Latitude"]; NSStrin
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"];
这看起来更像JSON,而不是NSArrayyes。它在JSON中,但是值不在字典中,而是在数组中。感谢您提供的信息,但是我之前提到过,来自服务器的信息是在数组中而不是在字典中。如果您提供的字符串是来自服务器的响应,则为和字典。粘贴响应字符串,我将编辑我的帖子。字典以“{”开头,数组以“[”开头。