在我的应用程序中,我正在使用Core Data框架。我在App Store上传了我的应用程序。
在它的第一个版本中,db工作得很好。更新我的应用程序后,我无法从数据库和应用程序崩溃中获取信息。我没有更改模型中的任何内容,下载最新更新的人没有问题。对于已更新我的应用的人来说,问题就出现了。你有什么想法吗?
-(void)viewWillAppear:(BOOL)animated
{
[array removeAllObjects];
LockAppDelegate *appDelegate = (LockAppDelegate *)[[UIApplication sharedApplication] delegate];
[array addObjectsFromArray:[appDelegate getAlbums]];
[photoAr removeAllObjects];
NSMutableArray *newArray = [NSMutableArray array];
for (int i=0; i<[array count]; i++) {
NSDictionary *dict;
if ([appDelegate get1PhotoFromAlbum:[array objectAtIndex:i]]) {
NSString *path = [NSString stringWithFormat:@"%@_small.png",[[appDelegate get1PhotoFromAlbum:[array objectAtIndex:i]] stringByDeletingPathExtension]];
// NSLog(@"%@",array);
[photoAr addObject:[UIImage imageWithContentsOfFile:path]];
NSLog(@"qq-%@",photoAr);
dict = [NSDictionary dictionaryWithObjectsAndKeys:
[UIImage imageWithContentsOfFile:path],@"image",
[array objectAtIndex:i],@"name",
nil];
} else {
dict = [NSDictionary dictionaryWithObjectsAndKeys:
nil,@"image",
[array objectAtIndex:i],@"name",
nil];
}
[newArray addObject:dict];
}
[array removeAllObjects];
[array addObjectsFromArray:newArray];
[table reloadData];
[[UIApplication sharedApplication] setStatusBarHidden:0 withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
}
这是我收到的崩溃日志。
0 CoreFoundation 0x32eef29e __exceptionPreprocess + 158 1 libobjc.A.dylib 0x3adaa97a objc_exception_throw + 26 2 CoreFoundation 0x32e398d4 - [__ NSArrayM insertObject:atIndex:] + 764 3 Safe Calc 0x0009c036 - [PhotoVideoController viewWillAppear:] (PhotoVideoController.m:142)4 UIKit 0x34d5e30c - [UIViewController _setViewAppearState:isAnimating:] + 132