ChenYalun / YAEasyProtector

App crash protection shield.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YAEasyProtector

Features

when these situations occur, it can avoid crash.

  • Unrecognized selector
  • Set value or get value with KVC
  • Add or remove elements repeatedly with KVO
  • Beyond bounds or null value with NSArray & NSMutableArray
  • Null value with NSDictionary & NSMutableDictionary
  • Circular reference with NSTimer

Usage

Set callback when crash occurs.

YAEasyProtector *sharedProtector = YAEasyProtector.sharedProtector;
sharedProtector.crashHandler = ^(NSDictionary *userInfo) {
   Class cls = userInfo[kYAEasyProtectorItemClassKey];
   YACrashType type    = [userInfo[kYAEasyProtectorItemTypeKey] integerValue];
   NSString *selector  = userInfo[kYAEasyProtectorItemSELKey];
   NSString *callStack = userInfo[kYAEasyProtectorItemCallStackKey];
   NSString *otherInfo = userInfo[kYAEasyProtectorItemUserInfoKey];
   NSLog(@"%lu, %@, %@, %@, %@", (unsigned long)type, cls, selector, callStack, otherInfo);
};

Article

iOS中的Crash防护

Author

Yalun, Chen

License

YAScrollPlaceView is available under the MIT license. See the LICENSE file for more info.

About

App crash protection shield.

License:MIT License


Languages

Language:Objective-C 100.0%