我想填充在集合视图细胞的Twitter信息,我的课堂作业,每次我试图用这个错误这样做,我的应用程序崩溃时错误:
Thread 6: EXC_BAD_INSTRUCTION (code=EXC_1386_INVOP)
以及调试窗口中显示的此语句:
-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0xa5744b0
。
我可以用什么解决方案来纠正这个错误?
要在这里看到我的整个项目是我的保管箱link to the entire project。主题6:EXC_BAD_INSTRUCTION(代码= EXC_1386_INVOP)使用UICollectionWiew
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
// here I am creating my cell for the custom View
CustomCollectionCellView *cellCollect = [theCollectionView dequeueReusableCellWithReuseIdentifier:@"customCell" forIndexPath:indexPath];
if (cellCollect != nil)
{
NSDictionary *userTweetDictionary = [usertwitterfeed objectAtIndex:indexPath.row];
if (userTweetDictionary != nil)
{
cellCollect.userNameLabel.text = (NSString *)[userTweetDictionary objectForKey:@"screen_name"];
//cellCollect.dateLabel.text = (NSString *)[tweetDictionary objectForKey:@"created_at"];
}
return cellCollect;
}
return nil;
}
'usertwitterfeed'是一个NSDictionary,而不是一个NSArray。 – CodaFi