2015-11-29 67 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

相關問題