2015-11-29 70 views
0

我试图弄清楚我的应用出了什么问题。它在发布模式下崩溃EXC_BAD_ACCESS,但是当我尝试检查僵尸时,它不会通过乐器崩溃。没有失败,我关闭僵尸检测,它崩溃。应用程序在发布模式下崩溃,但在启用僵尸时不崩溃

当它崩溃时,我唯一能说的是vm分配中最新的调用显示了这个viewDidLoad。所以我想知道这里有什么问题吗?

- (void)viewDidLoad 
{ 

    [super viewDidLoad]; 

    //load abstract 
    if (self.abstractId > 0){ 
     [self startQuery:@selector(getAbstractWithId:)]; 
    } 

    //setup nav bar 
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; 
    [self.view addSubview:[self makeFavoriteButton]]; 


    //add link attributes 
    self.linkAttributes = @{NSForegroundColorAttributeName: [UIColor colorWithHexString:emaGreen], 
          NSUnderlineColorAttributeName: [UIColor lightGrayColor], 
          NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)}; 


    //create text view 
    UITextView *tv = [[UITextView alloc] initWithFrame:self.view.frame]; 
    tv.editable = NO; 
    tv.textAlignment = NSTextAlignmentLeft; 
    tv.text = @" "; 
    tv.backgroundColor = [UIColor whiteColor]; 
    tv.scrollEnabled = YES; 
    tv.dataDetectorTypes = UIDataDetectorTypeLink; 
    tv.linkTextAttributes = self.linkAttributes; // customizes the appearance of links 
    tv.delegate = self; 

    // set the scroll indicators between nav and tabs 
    tv.scrollIndicatorInsets = UIEdgeInsetsMake(0, 
               0, 
               CGRectGetHeight(self.tabBarController.tabBar.frame), 
               0); 

    //add to property and view 
    self.tv = tv; 
    [self.view addSubview:tv]; 

    //Create spinner view 
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; 
    hud.mode = MBProgressHUDModeIndeterminate; 
    self.hud = hud; 

} 

我还有什么其他的调试选项?

谢谢!

+0

您可以尝试断点以查看哪条线路崩溃。 – ruthless

+0

您是否检查了方案以确保仪器构建和构建版本的构建方式相同? – matt

+1

当你启用僵尸时,整个问题就是应用程序不会再崩溃。相反,当您尝试执行一些错误的内存访问时,应该在调试控制台中看到一些输出。在启用僵尸进行调试时查找这些消息。 – rmaddy

回答

0

感谢您的意见。奇怪的是,我终于在僵尸中得到了一个控制台输出,并且出现以下KVO错误message received but not handled. 我能够追踪到一个未被删除的观察者。有史以来最糟糕的错误。啊。谢谢您的帮助!

-(void)dealloc 
{ 
    [self.queryQueue removeObserver:self forKeyPath:@"operations"]; 
} 
1

我会想这是这一行:

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

引述文档的UIControl参数:

目标:目标对象,也就是说,对象该动作消息被发送到该服务器。如果这是零,则响应者链搜索愿意响应动作消息的对象

动作:标识动作消息的选择器。它不能为空

奇怪的是,这不是UIBarButtonItem的初始值设定,但我看不出有任何理由不应该是真实的存在,除非该类实际检查这些参数null和相应的行为。

也许你的酒吧按钮项试图访问null选择器发送它,并在那里崩溃,或试图将它发送到一些已发布的对象。这只能通过一些优化来实现 - 例如,也许在释放模式下,按钮抓取指向将由消息发送调用的函数的指针,而不是发送消息作为优化。

至少,通过nil似乎有错误。

+0

谢谢,但这并没有解决问题。虽然我确实实施了一个存根操作来处理零。 – 4m1r

相关问题