我想填充在集合視圖細胞的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