我想知道是否有人可以提供一些帮助。基本上我打电话给一个网络服务,然后尝试获取大的托管图像网址。从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?
任何帮助,您可以提供非常感谢!
非常感谢我想这和它的工作。 – Anthony 2013-04-29 06:09:53
......以及以下所有人。我可能没有尝试过你的答案,但你的帮助真的很感激。 – Anthony 2013-04-29 06:11:34
还有一件事。有没有一种方法可以基本检查变量所保存的数据类型?是否有某种“这是一种”方法可以在这种情况下提供帮助? – Anthony 2013-04-29 06:21:19