Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITextView成为EXC访问错误的第一响应程序崩溃_Ios_Objective C_Xcode_Uiviewcontroller_Uitextview - Fatal编程技术网

Ios UITextView成为EXC访问错误的第一响应程序崩溃

Ios UITextView成为EXC访问错误的第一响应程序崩溃,ios,objective-c,xcode,uiviewcontroller,uitextview,Ios,Objective C,Xcode,Uiviewcontroller,Uitextview,我在故事板中有一个UIViewController和UITextView,我给它分配了一个强变量。第一次使用故事板segue显示ViewController时没有崩溃,但当我关闭ViewController并在[UITextView becomeFirstResponder]之后第二次显示ViewController时被称为应用程序崩溃,并显示以下错误 [UIViewController _responderWindow]: message sent to deallocated instanc

我在故事板中有一个UIViewController和UITextView,我给它分配了一个强变量。第一次使用故事板segue显示ViewController时没有崩溃,但当我关闭ViewController并在[UITextView becomeFirstResponder]之后第二次显示ViewController时被称为应用程序崩溃,并显示以下错误

[UIViewController _responderWindow]: message sent to deallocated instance
我已将委托分配给添加了TextView的ViewController,并实现了所有委托方法

我尝试在延迟后调用此方法[UITextview becomeFirstResponder] 但没用,它还在崩溃

我尝试用僵尸模板分析错误在UIKit中

这是当应用程序在产品方案中启用僵尸时崩溃时得到的响应

[ReviewViewController _responderWindow]: message sent to deallocated instance 0x14ed3a2a0
这是我用来展示具有textview的viewcontroller的代码

[_promotionsViewControllerDelegate performSegueWithIdentifier:@"testing" sender:nil];
文本视图视图控制器

  - (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

我恳请您在这方面帮助我。谢谢。

您是否在inspector窗口中检查了与代码(即测试)中给出的标识符类似的标识符


在您的.h文件中,您也给出了。如果没有,那么添加它。

可能太晚了,但我也遇到了同样的问题,解决方案是在我的vwc的dealoc方法中从superview发送remove

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

我使用了一个单独的viewcontroller进行测试,我也在inspector中进行了相同的测试。但是如果我尝试在其他项目中模拟相同的场景,它不会崩溃。。因此,我尝试使用单独的导航控制器,并且这些脚本文件不与任何自定义类链接。。我在rootviewcontroller中有一个textview,另一个viewcontroller有textview,我用一个按钮操作推过故事板序列。。我在根视图控制器中编辑textview,然后转到下一个场景并在那里进行编辑。返回时,我试图编辑应用程序,但由于相同的错误而崩溃。我被这个问题困扰了两天你有没有解决过这个问题?