哎呀!
arrayWithObjects:
需要零终止。以下代码运行正常:
NSMutableArray *myObjects = [NSMutableArray array];
NSArray *theObjects = [NSArray arrayWithObjects:@"easy as 1",@"easy as two", @"Easy as Three",nil];
NSArray *theKeys = [NSArray arrayWithObjects:@"A",@"B",@"C",nil];
NSDictionary *theDict = [NSDictionary dictionaryWithObjects:theObjects forKeys:theKeys];
[myObjects addObject:theDict];
for(id item in myObjects)
{
NSLog(@"Found an Item: %@",item);
}
我不知道为什么使用传统的循环隐藏了这个错误。