這個我使用的對象轉換爲整數值的線,在for循環中我已經把這個代碼如何將[__NSArrayI integerValue]轉換爲整數值?
NSInteger tag=[[arrFullSubCategory valueForKey:@"category"] integerValue];
內部arrFullSubCategory:
(
{
category = 35;
image = "images/Hatchback.jpg";
name = Hatchback;
parent = 20;
},
{
category = 36;
image = "images/Sedan.jpg";
name = Sedan;
parent = 20;
},
{
category = 37;
image = "images/SUV.jpg";
name = SUV;
parent = 20;
}
)
例外:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI integerValue]: unrecognized selector sent to instance 0x7ff4ba58f930'
做這樣的事情: [[[arrFullSubCategory objectatindex:我] valueForKey:@ 「類別」] integerValue]。 – Mehul
你期望得到哪個'類別', - 35,36或37? – dasblinkenlight
@dasblinkenlight everything ... –