2015-02-11 101 views
1

我有一個UIViewControllerUITextViewUITextView我爲它分配強變量。第一次當我提出使用故事板賽格視圖控制器沒有崩潰,但當我解僱ViewController和再次呈現ViewController第二次[UITextView becomeFirstResponder]被調用後的應用崩潰,並顯示以下錯誤UITextView與第一次EXC壞訪問

[UIViewController _responderWindow]: message sent to deallocated instance 

我已分配委託給在其中添加的TextView的ViewController並實施全部委託方法

我試圖調用此方法[UITextview becomeFirstResponder]延遲 之後,但沒有用它仍然崩潰

我試圖分析與殭屍模板中的錯誤是在UIKit

這是當應用程序崩潰,如果我得到的響應使殭屍在產品方案

[ReviewViewController _responderWindow]: message sent to deallocated instance 0x14ed3a2a0 

這是我使用以呈現其具有的TextView的視圖控制器的代碼

[_promotionsViewControllerDelegate performSegueWithIdentifier:@"testing" sender:nil]; 

TextView的視圖 - 控制

- (void)viewDidLoad { 
     [super viewDidLoad]; 
     _reviewTextView.delegate = self; 
     [_reviewTextView becomeFirstResponder]; 
     } 

這是回溯追蹤錯誤日誌當我運行沒有殭屍

* thread #1: tid = 0x758d4, 0x000000019271bbd0 libobjc.A.dylib`objc_msgSend + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x174697260) 
    frame #0: 0x000000019271bbd0 libobjc.A.dylib`objc_msgSend + 16 
    frame #1: 0x000000018675f96c UIKit`-[UIView(Internal) _firstResponder] + 24 
    frame #2: 0x000000018675f940 UIKit`-[UIResponder isFirstResponder] + 32 
    frame #3: 0x0000000186e96ed8 UIKit`-[UITextView _keyboardDidShow:] + 32 
    frame #4: 0x0000000181f58ae4 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20 
    frame #5: 0x0000000181e97220 CoreFoundation`_CFXNotificationPost + 2060 
    frame #6: 0x0000000182d96cc0 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 72 
    frame #7: 0x0000000186e5f458 UIKit`-[UIInputWindowController postEndNotifications:withInfo:] + 580 
    frame #8: 0x0000000186e60c7c UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke595 + 396 
    frame #9: 0x000000018679c0a4 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 408 
    frame #10: 0x000000018679bc0c UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 188 
    frame #11: 0x000000018679bb14 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 104 
    frame #12: 0x00000001860c0f64 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 296 
    frame #13: 0x00000001002b4df0 libdispatch.dylib`_dispatch_client_callout + 16 
    frame #14: 0x00000001002b975c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1056 
    frame #15: 0x0000000181f69fa4 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 
    frame #16: 0x0000000181f6804c CoreFoundation`__CFRunLoopRun + 1492 
    frame #17: 0x0000000181e950a4 CoreFoundation`CFRunLoopRunSpecific + 396 
    frame #18: 0x000000018b0375a4 GraphicsServices`GSEventRunModal + 168 
    frame #19: 0x00000001867ca3c0 UIKit`UIApplicationMain + 1488 
    * frame #20: 0x00000001000c1030 WineDisciples`main(argc=1, argv=0x000000016fd83a58) + 116 at main.m:14 
    frame #21: 0x0000000192d76a08 libdyld.dylib`start + 4 

我懇請你幫助我,這得益於應用..

+0

的dealloc方法你有沒有設法解決這個問題? – 2016-02-02 17:08:04

回答

0

您是否在檢查器窗口中檢查了您的標識符(與代碼中給出的類似) 「測試」)?

也在你的.h文件中給出了。如果沒有,然後添加它。

+0

我已經使用了一個單獨的viewcontroller測試目的,我已經在檢查員也給了相同的「測試」.. – user2922409 2015-02-12 05:46:09

+0

但是,如果我嘗試在其他項目中模擬相同的情況它不會崩潰..所以我試着有sepeate導航控制器和那些故事板文件沒有鏈接任何自定義類..我有一個textview在rootviewcontroller和另一個viewview控制器與textview這是通過故事板推動使用按鈕動作segue ..我編輯根視圖控制器中的textview並轉到下一個場景並在那裏編輯回來試圖編輯應用程序崩潰與相同的錯誤。我堅持了2天 – user2922409 2015-02-12 05:50:03

0

也許爲時已晚,但我有同樣的問題,解決的辦法是從發送去除上海華在我VWC

deinit { 
    self.commentTextView.delegate = nil 
    self.commentTextView.removeFromSuperview() 
}