快速降低iOS崩溃率 (只需要加入项目中)
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Array (__NSArrayM, __NSArray0, __NSArrayI, Unrecognized selector sent to instance):
NSArray *arr = @[];
NSMutableArray *mArr = @[].mutableCopy;
Unrecognized selector sent to instance ✅
*** Terminating app due to uncaught exception 'NSRangeException',
reason: '*** -[__NSArrayM objectAtIndex:]: index 6 beyond bounds for empty NSArray
id obj = arr[6]; ✅
id objc = [arr objectAtIndex:6]; ✅
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
[mArr addObject:nil]; ✅
Terminating app due to uncaught exception 'NSRangeException',reason: '*** -[__NSArrayM removeObjectAtIndex:]: index 6 beyond bounds for empty
[mArr removeObjectAtIndex:6]; ✅
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
[mArr insertObject:nil atIndex:6]; ✅
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM replaceObjectAtIndex:withObject:]: index 6 beyond bounds for empty
[mArr replaceObjectAtIndex:6 withObject:@"obj"]; ✅
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'example:NSString *k = nil; [NSArray arrayWithObject:k]
NSString *k = nil;
[NSArray arrayWithObject:k] ✅
*** -attempt to insert nil object from objects[0]
NSArray *ar = [NSArray arrayWithObjects:@"1",,@"2", nil]; ✅
DumbPatch is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DumbPatch'
macRong, rong@shengshui.com
DumbPatch is available under the MIT license. See the LICENSE file for more info.