0
时崩溃,我有以下IBAction
设置:程序追加对象的NSArray
#define FAVORITES_KEY @"GraphViewController.Favorites"
- (IBAction)addToFavorites:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray *favorites = [defaults objectForKey:FAVORITES_KEY];
if (!favorites) favorites = [NSMutableArray array];
[favorites addObject:self.program];
[defaults setObject:favorites forKey:FAVORITES_KEY];
[defaults synchronize];
}
第一次这个动作叫这一切运作良好,该对象被添加到我的阵列,并保存到NSUserDefaults
无问题后,首先调用它会抛出一个异常,增加了favorites
阵列的时候,如果我尝试跨过破它会这样说:
Single stepping until exit from function objc_exception_throw,
which has no line number information.
Catchpoint 3 (exception thrown).
任何人也有类似的问题,或者可能知道发生了什么事?
也做到了,小细节一样,是很好的了解。记得iOS总是与不可变的副本一起工作 – 8vius 2012-02-10 19:39:26