我的代码:
NSArray *keys = [piecesDict allKeys];
//keys are NSStrings of sprite names, piecesDict is NSDictionary
for(int i = 0; i < piecesDict.count; i++){
PuzzlePiece *piece;
id key = [keys objectAtIndex:i];
piece.keyName = key; }
崩溃的确切代码是piece.keyName = key
. 我明白了 EXC_BAD_ACCESS
。该.keyName
物业是(nonatomic, retain)
。我试过制作key
或NSString *
铸造它(NSString *)key
无济于事。
我在这里想念什么?