2017-08-10 23 views
-2

後的iOS更新版本10.3.3,錯誤出現在一些設備,而不是全部。那就是......NSLayoutConstraint常量不是有限的!這是違法的。恆:INF

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSLayoutConstraint constant is not finite! That's illegal. constant:inf firstAnchor:<NSLayoutXAxisAnchor:0x608000679c80 "_UINavigationBarContentView:0x7fce8d57aee0.right"> secondAnchor:<NSLayoutXAxisAnchor:0x608000679d00 "UILayoutGuide:0x6080001be680'UIViewLayoutMarginsGuide'.right">' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000110e3126b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x0000000114a67f41 objc_exception_throw + 48 
    2 CoreFoundation      0x0000000110e36402 +[NSException raise:format:arguments:] + 98 
    3 Foundation       0x0000000111a5b749 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 
    4 Foundation       0x00000001119df92c -[NSLayoutConstraint _setSymbolicConstant:constant:] + 629 
    5 Foundation       0x00000001119df689 -[NSLayoutConstraint setConstant:] + 68 
    6 UIKit        0x0000000112a6dc52 -[UIView _updateLayoutMarginsGuideConstraintsIfNecessary] + 358 
    7 UIKit        0x0000000112a6de5e -[UIView _layoutMarginsDidChangeFromOldMargins:] + 194 
    8 UIKit        0x0000000112a6e849 -[UIView _updateInferredLayoutMarginsFromSuperview:] + 850 
    9 UIKit        0x0000000112a6fc03 -[UIView setSafeAreaInsets:] + 446 
    10 UIKit        0x0000000112a6f2a5 -[UIView _updateSafeAreaInsets] + 125 
    11 UIKit        0x0000000112a9c30e -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1571 
    12 UIKit        0x0000000112adc343 -[UINavigationBar layoutSublayersOfLayer:] + 178 
    13 QuartzCore       0x000000011264cc92 -[CALayer layoutSublayers] + 153 
    14 QuartzCore       0x0000000112650d79 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401 
    15 QuartzCore       0x00000001125d9851 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 385 
    16 QuartzCore       0x00000001126051c2 _ZN2CA11Transaction6commitEv + 500 
    17 QuartzCore       0x0000000112605f14 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76 
    18 CoreFoundation      0x0000000110dd3e57 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 
    19 CoreFoundation      0x0000000110dd3dae __CFRunLoopDoObservers + 430 
    20 CoreFoundation      0x0000000110db83c4 __CFRunLoopRun + 1572 
    21 CoreFoundation      0x0000000110db7b29 CFRunLoopRunSpecific + 409 
    22 GraphicsServices     0x000000011a8dd9c6 GSEventRunModal + 62 
    23 UIKit        0x00000001129ce9a4 UIApplicationMain + 159 
    24 APP NAME       0x000000010f8c1847 main + 55 
    25 libdyld.dylib      0x0000000117f8d621 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

有趣的是,這個錯誤對所有設備都沒有任何意義。有在我的設備(iOS版10.3.3)沒有錯誤

所以我試圖在Xcode 9測試版5,iOS的11測試版5上運行這個程序,得到一些錯誤,並且出現此斷言失敗。我認爲對navigationBarItem有疑問。

請幫忙。

+0

有iOS11和以前的版本之間的差異。事物被棄用。這裏有兩個鏈接,可以幫助:https://useyourloaf.com/blog/safe-area-layout-guide/和https://useyourloaf.com/blog/changing-root-view-layout-margins/我敢打賭這是其中之一。理由是:(1)它適用於iOS 10.3.3,這意味着您使用的是Xcode 8.(2)它不適用於iOS 11/Xcode 9 beta 5。祝您好運! – dfd

+0

謝謝dfd。我會看到所有的鏈接。但是,我在同事的iPhone 7(iOS 10.3.3)中看到了這個錯誤..所以,我很困惑。 –

+0

我的建議是?按照這個邏輯進行。將「beta」(iOS11,Xcode9)與「當前」分開。消除有用的東西!然後,縮小範圍 - 如果它是iOS11,則使用Xcode 9和它非常穩定的模擬器來複制,如果不是,也可以查看是否有任何工作。接下來,使用斷點進行調試。 **底線?**如果您感到困惑,您將允許太多變量侵入您的*真實*問題。 (而且,它會越來越多地侵入你的問題。)**縮小事情的範圍!**拜託,只因爲你在同事的手機上遇到這個錯誤,並不意味着什麼!祝你好運。 – dfd

回答

0

在我的情況下試圖讓UITextField.firstRect()時,我得到了一個「無限」的由來一個有效UITextRange。這導致約束更新失敗。

我會建議獲得的Xcode 9,有調試代碼。

相關問題