Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
297 views
in Technique[技术] by (71.8m points)

ios - EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000000000c specialized systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:)

I am getting this crash repeatedly. This is a partial stack trace of the crash:

0
libobjc.A.dylib
AutoreleasePoolPage::AutoreleasePoolPage(AutoreleasePoolPage*) + 88
1
libobjc.A.dylib
AutoreleasePoolPage::autoreleaseFullPage(objc_object*, AutoreleasePoolPage*) + 64
2
libobjc.A.dylib
objc_object::rootAutorelease2() + 112
3
UIKitCore
-[UIView(AdditionalLayoutSupport) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:onBehalfOfLayoutGuide:] + 2120
4
UIKitCore
-[UIView(AdditionalLayoutSupport) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:] + 312
5
CoreAutoLayout
-[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 80
6
CoreAutoLayout
-[NSLayoutConstraint _addToEngine:mutuallyExclusiveConstraints:] + 140
7
UIKitCore
_UIViewEnumerateConstraints + 212
8
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 464
9
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 620
10
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 620
11
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 620
12
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 620
13
UIKitCore
-[UIView(UIConstraintBasedLayout) _populateEngineWithConstraintsForViewSubtree:forComputingFittingSizeOfView:] + 620
14
UIKitCore
__160-[UIView(UIConstraintBasedLayout) _calculatedSystemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:]_block_invoke.797 + 344
15
CoreAutoLayout
-[NSISEngine withBehaviors:performModifications:] + 88
16
UIKitCore
-[UIView(UIConstraintBasedLayout) _calculatedSystemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 1180
17
UIKitCore
-[UIView(AdditionalLayoutSupport) _systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 652
18
MyCell.swift - Line 54
specialized MyCell.systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:) + 54
19
<compiler-generated> - Line 4361653480
@objc MyCell.systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:) + 4361653480
20
UIKitCore
-[UICollectionReusableView preferredLayoutAttributesFittingAttributes:] + 328
21
UIKitCore
-[UICollectionReusableView _preferredLayoutAttributesFittingAttributes:] + 160
22
UIKitCore
-[UICollectionView _checkForPreferredAttributesInView:originalAttributes:] + 520
23
UIKitCore
-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 868

I am just calling the size calculation method on a particular view and it crashes. Is it possible that the crash is in UIKit? Would the complexity of the view itself can be a source of the crash?

Any help would be appreciated.


Edit:

So, some more context which might help in finding the root cause. I have a UICollectionViewCell that is MyCell. In this cell, a generic custom view(let's say MyView) is added to the contentView. I am overriding the below function:

func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize

And in this method, I am calling the same function on my custom view(i.e. MyView).

And that is the exact point of the crash when it happens. Maybe this can be helpful in identifying the root cause.

question from:https://stackoverflow.com/questions/65917495/exc-bad-access-kern-invalid-address-0x000000000000000c-specialized-systemlayouts

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...