简体   繁体   English

解雇UIViewController后崩溃

[英]Crash after dismissing an UIViewController

Since a short while I have a problem with my App that as soon as I dismiss a specific UIViewController the App crashes with Tread 1:breakpoint 1.1 7.1. 有一小段时间以来,我的应用程序出现问题,一旦我解雇了特定的UIViewController,应用程序就会因为Tread 1:breakpoint 1.1 7.1而崩溃。

I have narrowed the problem down to a 'Container view' which is placed in the view that is dismissed. 我将问题缩小为“容器视图”,该视图放置在被关闭的视图中。 I noticed that the main controller is dealloced first, and the the container view controller, but don't see what the problem is. 我注意到主控制器和容器视图控制器先被释放,但看不到问题出在哪里。 I am not sure when this problem was introduced as I was working a few days on particular interface issues and never used the 'navigate back' option. 我不确定何时引入此问题,因为我在特定的界面问题上工作了几天,却从未使用过“后退导航”选项。

I know the above description is very vague, but any suggestions how to debug the possible cause would be very very welcome as I have spend hours at it at this stage. 我知道上面的描述非常模糊,但是任何有关调试可能原因的建议都将非常受欢迎,因为我在此阶段花费了数小时。

#0  0x00000001954440a8 in objc_exception_throw ()
#1  0x0000000184d05d88 in +[NSException raise:format:] ()
#2  0x0000000185b59f00 in NSKVODeallocate ()
#3  0x0000000184be5378 in CFRelease ()
#4  0x0000000184bf1938 in -[__NSArrayM dealloc] ()
#5  0x000000019545d724 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#6  0x0000000184be8f94 in _CFAutoreleasePoolPop ()
#7  0x0000000184cbb750 in __CFRunLoopRun ()
#8  0x0000000184be91f4 in CFRunLoopRunSpecific ()
#9  0x000000018dd775a4 in GSEventRunModal ()
#10 0x000000018951a784 in UIApplicationMain ()
#11 0x00000001000cdc04 in main at /Users/Luuk/Documents/Xcode development/idoms-portal/iDoms/main.m:14
#12 0x0000000195ab2a08 in start ()

EDIT: I have narrowed it down to linking the container to the view controller: 编辑:我已将其范围缩小到将容器链接到视图控制器:

@interface DOPrototypeViewController : UIViewController <DOContentSizeCallback> {

    @protected
    DOMediaPlayerHelper* _mediaPlayerHelper;
    __weak NSString* _viewTitle;

    IBOutlet UIBarButtonItem *_previousPageBttn;
    IBOutlet UIBarButtonItem *_nextPageBttn;

    __weak IBOutlet UIView* _contentContainer;
    __weak IBOutlet UIScrollView* _scrollView;
}

@property (nonatomic, weak)  NSString* viewTitle;;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentViewHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentViewWidthConstraint;

Once the container in IB is linked the problem occurs. 一旦IB中的容器被链接,就会发生问题。 As mentioned above, it seems that the DOPrototypeViewController is unloaded first, before the contentContainer controller. 如上所述,似乎在ContentContainer控制器之前先卸载了DOPrototypeViewController。 It must have something to do with a link back to the parent view of the contentContainer I would feel. 它必须与链接回到我感觉到的contentContainer的父视图有关。

I've had these sort of crashes before. 我以前遇到过此类崩溃。 Normally a message is sent to an object that A: No longer exists. 通常,将消息发送到以下对象:A:不再存在。 B: Doesn't recognise the selector. B:无法识别选择器。

Start off at looking through the stack trace. 开始查看堆栈跟踪。 See what the last couple of calls were right before the crash. 看看崩溃前最后几个电话是什么。 This normally points you in the right direction. 这通常会为您指明正确的方向。

Also, post the crash log and stack trace here if you get stuck. 另外,如果遇到问题,请在此处发布崩溃日志和堆栈跟踪。

It was a reference. 这是一个参考。 I added an observer [[self view] addObserver:self forKeyPath:@"frame" options:0 context:nil]; 我添加了一个观察者[[self view] addObserver:self forKeyPath:@“ frame” options:0 context:nil]; in two controllers, and while I fixed one, never saw the second and did not remove it. 在两个控制器中,当我固定一个控制器时,从未看到第二个控制器,也没有将其移除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM