DurexKit could greatly reduce the probability of crash.
It’s very easy to use without modifying any code.
1.Download the source code and copy the folder named "DurexKit" to your project.
2.#import "DurexKit.h" (Not required)
+ (void) load{
[self swizzleMethod:@selector(SKobjectAtIndex:) targetClass:@"__NSArrayI" target:@selector(objectAtIndex:)];
[self swizzleMethod:@selector(SKarrayByAddingObject:) targetClass:@"__NSArrayI" target:@selector(arrayByAddingObject:)];
}
#define SafeKitLogTypeNone 0
#define SafeKitLogTypeInfo 1
#define SafeKitLogTypeWarning 2
#define SafeKitLogTypeError 4
setSafeKitLogType(SafeKitLogTypeNone);
setSafeKitLogType(SafeKitLogTypeInfo | SafeKitLogTypeWarning | SafeKitLogTypeError);
[[SafeKitLog shareInstance]log:@“info“];
The method will invoke NSLog to print “info” on console.Also,you could use yourself way to record log.You just need to implement the interface of ”SafeKitPrinter”.
This is default implementation.
@interface SafeKitConsolePrinter : SafeKitPrinter
@end
[[SafeKitLog shareInstance]setPrinter:printer];
typedef enum{
SafeKitObjectPerformExceptionCatchOn,//default
SafeKitObjectPerformExceptionCatchOff
} SafeKitObjectPerformExceptionCatch;
setSafeKitObjectPerformExceptionCatch(SafeKitObjectPerformExceptionCatchOn);
setSafeKitObjectPerformExceptionCatch(SafeKitObjectPerformExceptionCatchOff);
DurexKit is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.
Contributions are totally welcome. We'll review all pull requests and if you send us a good one/are interested we're happy to give you push access to the repo. Or, you know, you could just come work with us.
Please pay attention to add Star, your support is my greatest motivation, thank you.