2017-08-17 2 views
1

Je reçois au hasard cette trace de la pile de certains utilisateurs iOS 10.3.3:iOS 10.3.3 UIButton _intrinsicSizeWithinSize/_updateTitleView CoreFoundation accident

-[_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 

Pour certains utilisateurs - [UIButton _intrinsicSizeWithinSize:] est remplacé par - [UIButton _updateTitleView]

l'application est à la fois à l'aide Objective-C et Swift 3.

Je ne suis pas en mesure de reproduire le crash sur mes périphériques/simulateur.

Malheureusement, je n'ai pas d'autres informations sur le problème.

Quelqu'un at-il fait face à un problème similaire?

TIA

Répondre

0

J'ai finalement découvert la source du problème!

Le choc peut être obtenu par le code suivant

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

je suis l'attribution de la NSDictionary@{@"key": @2, @"name": @"Name2"} à title (sans avertissement), je suis passé le NSDictionary comme NSString la méthode [UIButton setTitle:forState:].

Je fixe la question de redéfinir array comme

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

et changer la valeur que j'attribue à titlearray[1]-array[1][@"name"].

+0

Cela semble être le même problème d'affectation d'un NSDictionary à un NSString, puis de l'utilisation de NSString dans un composant d'interface utilisateur. Cela provoque un crash étrange qui ne précise pas la ligne exacte de l'erreur. Il est rapporté ici: https://stackoverflow.com/questions/25296242 et https://stackoverflow.com/questions/23359356 et https://stackoverflow.com/questions/22966650 –