To run the example project, clone the repo, and run pod install
from the Example directory first.
/*
入参异常防御
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
NSArray * array = [NSArray new];
[array safeContainer];
id result = array[1000];
NSLog(@"%@", result);
[self safeKeyValue];
[self setValue:nil forKey:nil];
[self valueForKey:nil];
[self setValue:nil forKey:@"dfadfadfa"];
[self setValue:@"dfadfad" forKey:nil];
[[NSUserDefaults standardUserDefaults] safeUserDefaults];
[[NSUserDefaults standardUserDefaults] objectForKey:nil];
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
/*
转发防御
*/
[NSObject safeGuardUnrecognizedSelector];
[NSObject performSelector:@selector(AAAA)];
[self performSelector:@selector(AAAA)];
[NSObject performSelector:@selector(AAAA)];
[self performSelector:@selector(AAAA)];
#pragma clang diagnostic pop
SecureDefense is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SecureDefense'
BetrayalPromise, [email protected]
SecureDefense is available under the MIT license. See the LICENSE file for more info.