私のアプリでは、Core Data フレームワークを使用しています。アプリケーションを App Store にアップロードしました。
最初のバージョンでは、データベースはうまく機能していました。アプリを更新した後、データベースから情報を取得できず、アプリケーションがクラッシュします。私はモデルに何も変更を加えていません。最新のアップデートをダウンロードする人には問題はありません。アプリを更新した人に問題が発生します。何かアイデアはありますか?
-(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 viewWillAppear:] -4 PhotoVideoController.m UId04: [UIViewController _setViewAppearState:isAnimating:] + 132