Our app has many crashes on iOS 16.2 beta1/2/3. It crash on a [NSDictionary boolValueForKey:] but not in our implementation, in a AccountsDaemon module, which can not found any information with google.
Our category function is here: @implementation NSDictionary (TypeCheck)
- (BOOL)boolValueForKey:(id)key
{ if(!key) { return NO; } BOOL result = NO; id val = [self objectForKey:key]; if ([val isKindOfClass:[NSNumber class]]) { result = [(NSNumber*)val boolValue]; } else if ([val isKindOfClass:[NSString class]]) { result = [(NSString*)val boolValue]; } return result; }
And the exception stack is bellow: __NSCFNumber找不到对应的length方法实现 2 QQKSong 0x00000001041d80f4 autoAddMethod(SelectorReceiver.m:38) 3 3 Foundation 0x00000001876783b4 -[NSDictionary(NSKeyValueCoding) valueForKey:] + 56 4 4 AccountsDaemon 0x00000001f266f930 -[NSDictionary(TypeSafeAccess) boolValueForKey:] + 44 5 5 QQKSong 0x0000000104afd108 -[vc updateViewWhenTargetInfoChange] 6