Files
yuyin_ios/SweetParty/第三方库/AvoidCrash/NSObject+AvoidCrash.h

35 lines
998 B
C
Raw Permalink Normal View History

2025-08-08 11:05:33 +08:00
//
// NSObject+AvoidCrash.h
// https://github.com/chenfanfang/AvoidCrash
//
// Created by mac on 16/10/11.
// Copyright © 2016年 chenfanfang. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject (AvoidCrash)
/**
* ifDealWithNoneSel : "unrecognized selector sent to instance"
*/
+ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel;
+ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
+ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
@end
/**
* Can avoid crash method
*
* 1.- (void)setValue:(id)value forKey:(NSString *)key
* 2.- (void)setValue:(id)value forKeyPath:(NSString *)keyPath
* 3.- (void)setValue:(id)value forUndefinedKey:(NSString *)key //这个方法一般用来重写,不会主动调用
* 4.- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues
* 5. unrecognized selector sent to instance
*/