gpt4 book ai didi

objective-c - iOS 10.3.3 UIButton _intrinsicSizeWithinSize/_updateTitleView CoreFoundation 崩溃

转载 作者:行者123 更新时间:2023-12-01 18:32:51 29 4
gpt4 key购买 nike

我从一些 iOS 10.3.3 用户处随机获取此堆栈跟踪:

-[_TtGCs26_SwiftDeferredNSDictionarySSP__ length]: unrecognized selector sent to instance 0x174421880

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x183416fe0 __exceptionPreprocess
1 libobjc.A.dylib 0x181e78538 objc_exception_throw
2 CoreFoundation 0x18341def4 __methodDescriptionForSelector
3 CoreFoundation 0x18341af54 ___forwarding___
4 CoreFoundation 0x183316d4c _CF_forwarding_prep_0
5 UIKit 0x189a437d0 -[UIButton _updateTitleView]
6 UIKit 0x1895bf828 -[UIButton tintColorDidChange]
7 UIKit 0x189a5d9d8 -[_UITintColorVisitor _visitView:]
8 UIKit 0x189a5e0bc _UIViewVisitorEntertainVisitors
9 UIKit 0x189a5d1f0 _UIViewVisitorRecursivelyEntertainDescendingVisitors
10 UIKit 0x189a5d2a0 _UIViewVisitorRecursivelyEntertainDescendingVisitors
11 UIKit 0x189a5cb3c _UIViewVisitorEntertainDescendingTrackingVisitors
12 UIKit 0x1895445a8 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke
13 Foundation 0x183e51abc -[NSISEngine withBehaviors:performModifications:]
14 UIKit 0x1895443b0 -[UIView(Hierarchy) _postMovedFromSuperview:]
15 UIKit 0x1895502ac -[UIView(Internal) _addSubview:positioned:relativeTo:]
16 UIKit 0x18954fbc8 -[UIView(Hierarchy) addSubview:]
17 UIKit 0x18982d81c -[UIView _setTraitStorageSubviews:]
18 Foundation 0x183e2c68c -[NSObject(NSKeyValueCoding) setValue:forKey:]
19 UIKit 0x189846b78 -[UIView(CALayerDelegate) setValue:forKey:]
20 UIKit 0x1899ccb50 -[_UIRelationshipTraitStorage applyRecordsMatchingTraitCollection:]
21 UIKit 0x1899cb500 -[NSObject(_UITraitStorageAccessors) _applyTraitStorageRecordsForTraitCollection:]
22 UIKit 0x189831364 -[UIView _traitCollectionDidChangeFromOldCollection:toNewCollection:scaleDidChange:]
23 UIKit 0x189831488 -[UIView _wrappedProcessDidChangeRecursivelyFromOldTraits:toCurrentTraits:scaleDidChange:forceNotification:]
24 UIKit 0x189ea84c8 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:]
25 UIKit 0x1898316ec -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:]
26 UIKit 0x189545c50 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
27 QuartzCore 0x186736274 -[CALayer layoutSublayers]
28 QuartzCore 0x18672ade8 CA::Layer::layout_if_needed(CA::Transaction*)
29 QuartzCore 0x18672aca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
30 QuartzCore 0x1866a634c CA::Context::commit_transaction(CA::Transaction*)
31 QuartzCore 0x1866cd3ac CA::Transaction::commit()
32 QuartzCore 0x1866cde78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
33 CoreFoundation 0x1833c49a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
34 CoreFoundation 0x1833c2630 __CFRunLoopDoObservers
35 CoreFoundation 0x1833c2a7c __CFRunLoopRun
36 CoreFoundation 0x1832f2da4 CFRunLoopRunSpecific
37 GraphicsServices 0x184d5d074 GSEventRunModal
38 UIKit 0x1895adc9c UIApplicationMain
39 <myapp> 0x10006bf9c main (main.m:14)
40 libdyld.dylib 0x18230159c start

对于某些用户 -[UIButton _intrinsicSizeWithinSize:]被替换为 -[UIButton_updateTitleView]

该应用同时使用 Objective-C 和 Swift 3。

我无法在我的设备/模拟器上重现崩溃。

不幸的是,我没有关于该问题的任何其他信息。

有人遇到过类似的问题吗?

TIA

最佳答案

我终于找到问题的根源了!

可以使用以下代码实现崩溃

NSArray *array = @[
@{@"key": @1, @"name": @"Name1"},
@{@"key": @2, @"name": @"Name2"},
@{@"key": @3, @"name": @"Name3"}
];
NSString *title = array[1];
[button setTitle: title forState: UIControlStateNormal];

我正在分配NSDictionary @{@"key": @2, @"name": @"Name2"}title (没有任何警告),然后我通过了 NSDictionary作为NSString[UIButton setTitle:forState:]方法。

我解决了重新定义 array 的问题作为

NSArray<NSDictionary<NSString *, id> *> *array;

并更改我分配给 title 的值来自array[1]array[1][@"name"] .

关于objective-c - iOS 10.3.3 UIButton _intrinsicSizeWithinSize/_updateTitleView CoreFoundation 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45732267/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com