【发布时间】:2013-04-28 18:15:57
【问题描述】:
我想知道是否有人可以提供一些帮助。基本上我正在调用网络服务,然后尝试获取大型托管图像 url。 Web 服务的输出是这样的:
images = (
{
hostedLargeUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.l.jpg";
hostedSmallUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.s.jpg";
}
);
主要问题是这两个字符串仅在我的数组元素之一中,而我认为它们应该在 2 中。而且我不是 100%,但可能它们可能是字典:-S 我不是当然。我的代码如下:
NSArray *imageArray = [[NSArray alloc]init];
imageArray = [self.detailedSearchYummlyRecipeResults objectForKey:@"images"];
NSLog(@"imageArray: %@", imageArray);
NSLog(@"count imageArray: %lu", (unsigned long)[imageArray count]);
NSString *hostedLargeurlString = [imageArray objectAtIndex:0];
NSLog(@"imageArrayString: %@", hostedLargeurlString);
上述代码的输出(nslog)是:
2013-04-28 18:59:52.265 CustomTableView[2635:11303] imageArray: (
{
hostedLargeUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.l.jpg";
hostedSmallUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.s.jpg";
}
)
2013-04-28 18:59:52.266 CustomTableView[2635:11303] count imageArray: 1
2013-04-28 18:59:52.266 CustomTableView[2635:11303] imageArrayString: {
hostedLargeUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.l.jpg";
hostedSmallUrl = "http://i.yummly.com/Crispy-roasted-chickpeas-_garbanzo-beans_-308444.s.jpg";
}
有谁知道如何将一个元素分别分成hostedlargeUrl 和hostedsmallUrl?
非常感谢您提供的任何帮助!
【问题讨论】:
标签: ios objective-c json nsstring nsarray