Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.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 ViewDid上的应用程序崩溃消失_Ios_Swift_Crash - Fatal编程技术网

Ios ViewDid上的应用程序崩溃消失

Ios ViewDid上的应用程序崩溃消失,ios,swift,crash,Ios,Swift,Crash,只有iOS 10.2版本的5、5s和SE机型才会出现一个非常奇怪的崩溃。Firebase表示,100%的事故发生在后台 我能够准确地重现崩溃的堆栈(但不是模拟器上的崩溃本身),并且只知道当用户退出应用程序时才会发生。似乎没有其他代码在真正崩溃时被调用,因为在这种情况下堆栈发生了变化 实际上,撞车报告中提到的那一行紧接着 超级。视图消失(动画),它是空白的 override func viewDidDisappear(_ animated: Bool) { super.vi

只有iOS 10.2版本的5、5s和SE机型才会出现一个非常奇怪的崩溃。Firebase表示,100%的事故发生在后台

我能够准确地重现崩溃的堆栈(但不是模拟器上的崩溃本身),并且只知道当用户退出应用程序时才会发生。似乎没有其他代码在真正崩溃时被调用,因为在这种情况下堆栈发生了变化

实际上,撞车报告中提到的那一行紧接着
超级。视图消失(动画),它是空白的

    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)

        self.keyboardAvoiding.endAvoiding()
    }
键盘回避

 func endAvoiding()
{
    self.avoiding = false

    // Update view frame
    updateConstraint(nil)
}


   private func updateConstraint(_ keyboardFrame: CGRect?, animationDuration: TimeInterval? = 0.0)
    {
        // Disable animation
        let state = UIView.areAnimationsEnabled
        UIView.setAnimationsEnabled(false)

        // Force to recalculate view frame if needed (without animation)
        self.view.superview?.layoutIfNeeded()

        // Restore previous animation state
        UIView.setAnimationsEnabled(state)

        if let keyboardFrame = keyboardFrame
        {
            // Decrease view frame
            self.constraint.constant = keyboardFrame.height
        }
        else {
            // Reset bottom constraint to initial value
            self.constraint.constant = self.initialConstraintConstant
        }

        // Layout superview
        UIView.animate(withDuration: animationDuration ?? 0.0, animations: {
            self.view.superview?.layoutIfNeeded()
            if let keyboardAvoidingScrollView = self.view.firstViewOfClass(TPKeyboardAvoidingScrollView.self)
            {
                // Scroll to active text field if scroll view frame changed
                keyboardAvoidingScrollView.scrollToActiveTextField()
            }
        })

    }
以下是事故报告:

Hardware Model:      iPhone6,2
Code Type:       ARM-64
Parent Process:  ??? [1]

OS Version:      iPhone OS 10.2 (14C92)

Exception Type:  SIGTRAP
Exception Codes: #0 at 0x100255178
Crashed Thread:  0

Application Specific Information:
Selector name found in current argument registers: release

Thread 0 Crashed:
0   _______                              0x0000000100255178 _______.PhoneNumberController.viewDidDisappear(Swift.Bool) -> () (PhoneNumberController.swift:97)
1   _______                              0x00000001002551a4 @objc _______.PhoneNumberController.viewDidDisappear(Swift.Bool) -> () (PhoneNumberController.swift:0)
2   UIKit                                0x000000018e7026f4 -[UIViewController _setViewAppearState:isAnimating:] + 524
3   UIKit                                0x000000018e7765b4 -[UIViewController __viewDidDisappear:] + 140
4   UIKit                                0x000000018e7c02e0 -[UINavigationController viewDidDisappear:] + 228
5   UIKit                                0x000000018e7026f4 -[UIViewController _setViewAppearState:isAnimating:] + 524
6   UIKit                                0x000000018e7765b4 -[UIViewController __viewDidDisappear:] + 140
7   CoreFoundation                       0x00000001887ceb10 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
8   CoreFoundation                       0x00000001887ce214 _CFXRegistrationPost + 396
9   CoreFoundation                       0x00000001887cdf90 ___CFXNotificationPost_block_invoke + 56
10  CoreFoundation                       0x000000018883db8c -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1500
11  CoreFoundation                       0x000000018870fe64 _CFXNotificationPost + 372
12  Foundation                           0x0000000189244e0c -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
13  UIKit                                0x000000018e9785d8 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke.2100 + 288
14  UIKit                                0x000000018e97bfdc _runAfterCACommitDeferredBlocks + 288
15  UIKit                                0x000000018e96dd50 _cleanUpAfterCAFlushAndRunDeferredBlocks + 556
16  UIKit                                0x000000018e6dd0b4 _afterCACommitHandler + 164
17  CoreFoundation                       0x00000001887e20c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
18  CoreFoundation                       0x00000001887dfcf0 __CFRunLoopDoObservers + 368
19  CoreFoundation                       0x00000001887e0180 __CFRunLoopRun + 1020
20  CoreFoundation                       0x000000018870e2b8 CFRunLoopRunSpecific + 440
21  GraphicsServices                     0x000000018a1c2198 GSEventRunModal + 176
22  UIKit                                0x000000018e7557fc -[UIApplication _run] + 680
23  UIKit                                0x000000018e750534 UIApplicationMain + 204
24  _______                              0x00000001000e3188 main (AppDelegate.swift:25)
25  ???                                  0x00000001876f15b8 0x0 + 0

添加相应的代码。您是否在viewcontroller中注册了任何通知观察员?否。没有任何通知观察员…但我得到了键盘观察员类型的ivar。如果控制器调用deinit,它会正确地删除观察者。如果您使用IQKeyboardManager而不是此库“TPKeyboardAvoidingScrollView”,则更好,您不需要管理ScrollToActivityExtTextField。如果你让特定的文本域/文本视图成为第一响应者,它会自动管理。这不取决于我