An Global protection scheme..
- Add
pod 'MSCrashProtector'
to your Podfile. - Run
pod install
- Add all files under
MSCrashProtector
to your project
- iOS 5.0 and greater
- ARC/MRC
#import "MSCrashProtector.h"
//NSArray
NSArray* arr = @[@"1"];
[arr objectAtIndexSafe:10];
id obj = [arr objectAtIndex:0 kindOfClass:[NSString class]];
NSLog(@"%@",obj);
//NSMutableArray
NSMutableArray* marr = [NSMutableArray array];
[marr addObjectSafe:nil];
[marr removeObjectAtIndexInBoundary:100];
[marr insertObject:@111 atIndexInBoundary:100];
//NSDictionary
NSDictionary* dic = [NSDictionary dictionary];
[dic objectForKey:nil defaultValue:@"test"];
//NSMutableDictionary
NSMutableDictionary* mdic = [NSMutableDictionary dictionary];
[mdic setObjectSafe:nil forKey:nil];
MSCrashProtector is available under the MIT license. See the LICENSE file for more info.