我初始化这个NSMutableDictionary
:
define TAREFA @"TAREFA"
define DATA_ITEM @"DATA"
define HORA_ITEM @"HORAS"
define ID @"ID"
define STATE @"NA"
define APROVED @"APROVED"
define REJECTED @"REJECTED"
itensArray = [[NSMutableArray alloc] init];
for (int i=0; i< [listagens size]; i++)
{
NSMutableDictionary *tmpDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
[[listagens item:i] WI_ID], ID,
[[listagens item:i] WI_TEXT], TAREFA,
[[listagens item:i] WI_CD], DATA_ITEM,
[[listagens item:i] WI_CT], HORA_ITEM,
STATE, STATE,
nil];
[itensArray addObject:tmpDictionary];
}
稍后,我执行以下操作:
for (int i=0; i<[itensArray count]; i++)
{
if ([[[itensArray objectAtIndex:i] objectForKey:ID] isEqualToString:cell.idLabel.text]) {
[[itensArray objectAtIndex:i] setString:APROVED forKey:STATE];
break;
}
}
我初始化了数组,然后,我更改了 NSMutableDictionary 的字符串。当我设置值时,我得到以下运行时错误:
'NSInvalidArgumentException',原因:'-[__NSCFDictionary setString:forKey:]:无法识别的选择器发送到实例 0x7b7d170'
看来我没有正确更改值。是语法错误吗?它是如何完成的?