我想知道迭代NSmutableArray是如何工作的,但是当我调用ObjectAtindex时,它会失败,并显示“***-[nscfset objectAtindex::无法识别的选择器发送到实例0x…”
这是一些示例代码,程序太大,无法共享整个程序,所以我希望它足够。代码在Xcode最新的iPhone模拟器中执行。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
RDLogString(@"Creating cell @ row no. %d", indexPath.row);
CPPlayerAppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
RDLogString(@"Conversations: %p. Item count: %d", appDelegate.distribution.conversations, appDelegate.distribution.conversations.count);
//This works
for(CPConversation * x in appDelegate.distribution.conversations){
RDLogString(@"Pointer: %p with name %@", x, x.name);
}
//This fails with aforementioned error
CPConversation * conversationAtCurrentIndex = [appDelegate.distribution.conversations objectAtIndex: indexPath.row];
抱歉,格式不好,还没弄清楚。:)
事先谢谢,
尼克