當我嘗試向我的NSMutableArray插入一個對象時,出現'程序接收信號:SIGABRT'錯誤,但我不明白爲什麼。當向NSMutableArray插入對象時'程序接收信號:SIGABRT'
這是我的代碼,特別是它導致錯誤的insertObject:value
。從NSUserDefaults
返回
NSMutableDictionary *myDictionary = [NSMutableDictionary dictionary];
[myDictionary setValue:valueName.text forKey:kValueName];
[myDictionary setObject:subValuesList forKey:kSubValuesList];
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
int position = appDelegate.position;
NSMutableArray *valuesList = [[NSUserDefaults standardUserDefaults] objectForKey:kValuesArray];
[valuesList insertObject:myDictionary atIndex:position];
謝謝!自很久以來一直在類似的問題上苦苦掙扎... – iOSDev