0

if ブロックの外で宣言された変数に別のオブジェクトを割り当てようとすると、「cincompatible 型 'id' から 'BNRItem' に割り当てています」というエラーが発生しました。変数を宣言して値を代入すると同じエラーが発生しないのに、if ステートメントで再代入しようとするとエラーが発生するのはなぜですか? ご協力いただきありがとうございます !

BNRItem *p = [[[BNRItemStore sharedStore] getHighValueItems]    <== no error
                  objectAtIndex:[indexPath row]];

if(indexPath.section==1){
        *p = [[[BNRItemStore sharedStore] getLowValueItems] <== error 
                 objectAtIndex:[indexPath row]];

}
4

2 に答える 2