破坏的应用程序,ViewWillAppear之后的UIViewcontroller EXC_BAD_ACCESS

时间:2012-10-07 07:17:40

标签: ios uiviewcontroller pushviewcontroller

突然间,我必须在我的应用程序中更改某些内容,导致其随机崩溃。在viewWillAppear之后,我得到一个EXC_BAD_ACCESS。我在视图加载方法中对所有内容进行了评论,以便初始化一个简单的视图。有时它运行正常而其他没有,我附上两个不同的控制台日志。

-(void) loadView {
        UIView *uv = [[UIView alloc] initWithFrame:CGRectZero];
        [self setView:uv];
        [uv release];
        NSLog(@"[BookScrollVC.m] loadView >>>");
}

当它崩溃时

2012-10-07 09:07:51.780 DILPStatic[2340:207] [BookScrollVC.m] loadView >>>
2012-10-07 09:07:51.781 DILPStatic[2340:207] [BookScrollVC.m] viewDidLoad
2012-10-07 09:07:51.782 DILPStatic[2340:207] [viewDidLoad] exiting...
2012-10-07 09:07:51.783 DILPStatic[2340:207] [viewWillAppear]
Current language:  auto; currently objective-c
Program received signal:  “EXC_BAD_ACCESS”.

什么时候工作

2012-10-07 09:12:54.702 DILPStatic[2385:207] [BookScrollVC.m] loadView >>>
2012-10-07 09:12:54.703 DILPStatic[2385:207] [BookScrollVC.m] viewDidLoad
2012-10-07 09:12:54.704 DILPStatic[2385:207] [viewDidLoad] exiting...
2012-10-07 09:12:54.705 DILPStatic[2385:207] [viewWillAppear]
2012-10-07 09:12:54.706 DILPStatic[2385:207] *** __NSAutoreleaseFreedObject(): release of previously deallocated object (0x4b59fc0) ignored
2012-10-07 09:12:55.058 DILPStatic[2385:207] [viewDidAppear]

通过pushviewcontroller加载。

BookScrollVC *bookScrollVC = [[BookScrollVC alloc] initWithBook:bookPath];


[self.navigationController setToolbarHidden:YES];
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController pushViewController:bookScrollVC animated:YES];

[bookScrollVC release]; 

1 个答案:

答案 0 :(得分:1)

我确实通过清理其他类中未正确使用的变量来解决问题。这包括丢失[...发布]和错误地解除分配ivars。

希望它提醒某人实际检查这些东西,尽管它可能不再是ARC的问题。