0

在我的应用程序中,我使用的是 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 安全计算 0x0009c036 -[PhotoVideoController viewWillAppear:] (PhotoVideoController03:4d45304) [UIViewController _setViewAppearState:isAnimating:] + 132

4

0 回答 0