【发布时间】:2014-10-01 10:51:45
【问题描述】:
无法重现以下崩溃。
我已经处理了这个案例:在一个 viewcontroller 动画的时候没有 segueing viewcontroller。 这里提到了类似的问题:iOS app error - Can't add self as subview。我已经实施了this 解决方案以实现安全隔离。
我仍然在崩溃。
注意:在 iOS 7 和 8 上都会发生崩溃,但在 iOS 8 上会发生更多崩溃。(如果有帮助的话)。即使从 viewDidLoad 中分离也不会在模拟器中崩溃。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'
Application Specific Backtrace 1:
0 CoreFoundation 0x24503f87 <redacted> + 126
1 libobjc.A.dylib 0x31c62c77 _objc_exception_throw + 38
2 CoreFoundation 0x24503ecd -[NSException initWithCoder:] + 0
3 UIKit 0x279880b3 -[UIView _addSubview:positioned:relativeTo:] + 114
4 UIKit 0x27988037 -[UIView addSubview:] + 30
5 UIKit 0x27b4d491 <redacted> + 1236
6 UIKit 0x2798e701 +[UIView performWithoutAnimation:] + 72
7 UIKit 0x27b4cd79 -[_UINavigationParallaxTransition animateTransition:] + 808
8 UIKit 0x27b0b787 -[UINavigationController _startCustomTransition:] + 2854
9 UIKit 0x27a2ab2f -[UINavigationController _startDeferredTransitionIfNeeded:] + 422
10 UIKit 0x27a2a931 -[UINavigationController __viewWillLayoutSubviews] + 44
11 UIKit 0x27a2a8c9 -[UILayoutContainerView layoutSubviews] + 184
12 UIKit 0x2797f25f -[UIView layoutSublayersOfLayer:] + 514
13 QuartzCore 0x273aa1d5 -[CALayer layoutSublayers] + 136
14 QuartzCore 0x273a5bd1 <redacted> + 360
15 QuartzCore 0x273a5a59 <redacted> + 16
16 QuartzCore 0x273a5447 <redacted> + 222
17 QuartzCore 0x273a5251 <redacted> + 324
18 UIKit 0x27980c31 <redacted> + 1384
19 CoreFoundation 0x244ca807 <redacted> + 14
20 CoreFoundation 0x244c9c1b <redacted> + 222
21 CoreFoundation 0x244c8299 <redacted> + 768
22 CoreFoundation 0x24415db1 _CFRunLoopRunSpecific + 476
23 CoreFoundation 0x24415bc3 _CFRunLoopRunInMode + 106
24 GraphicsServices 0x2b7a0051 _GSEventRunModal + 136
25 UIKit 0x279e0f01 _UIApplicationMain + 1440
【问题讨论】:
-
当您调用非同步转换时,有时会发生这种情况。也许您在故事板和代码中的相同操作上推送了相同的 VC?或者你在推出另一个 VC 之前先推一些 VC?
-
我在一个地方使用了
performSegueWithIdentifier:和popToViewController: animated:。需要澄清“或者你在推出另一个 VC 之前先推一些 VC?” -
尝试搜索嵌套过渡。必须在某个地方在弹出另一个 ViewController 之前推送一些 ViewController...或者在转换完成之前推送一些 ViewController 的地方。
-
好的,如果是这种情况,我会尝试搜索,但正如我在问题中提到的那样,我使用
navigationController:didShowViewController:animated:来解决这个问题(安全转场)。 -
我在
viewDidLoad的一个地方进行搜索,这可能是这次崩溃的原因吗?
标签: ios objective-c iphone