UIViewControllerがNSObjectであるため、NSMutableDictionaryにUIViewControllerのサブクラスを追加しても問題ありません。UIViewControllerサブクラスをNSDictionaryに追加できません
NSArray *requestingPathes = [[NSArray alloc] initWithObjects:indexPath, nil];
requestingPair = [[NSMutableDictionary alloc] initWithObjectsAndKeys:requestingPathes, dele, nil];
(言及サブクラスであることを起こる)デリゲート「DELEは」辞書「requestingPair」を初期化するために使用されているアプリのクラッシュ:
これは私のコードです。
エラーは次のとおりです。
-[MainViewController copyWithZone:]: unrecognized selector sent to instance 0x7446b30
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainViewController copyWithZone:]: unrecognized selector sent to instance 0x7446b30
0x7446b30は、サブクラスのアドレスである「MainViewController
ですが、なぜでしょう
デリゲートがキーである必要があります。それぞれがindexPathesの配列に関連付けられたデリゲートのリストがあります。私はキーがコピーされているか分からなかった。だからNSNumberとしてデリゲートのアドレスを格納します。 –