Latest 0.0.6
Homepage https://github.com/jezzmemo/JJException
License MIT
Platforms ios 8.0
Authors

CocoaPods Compatible
Platform
License MIT

保护App,一般常见的问题不会导致闪退,增强App的健壮性,同时会将错误抛出来,根据每个App自身的日志渠道记录,下次迭代或者热修复以下问题.

  • [x] Unrecognized Selector Sent to Instance

  • [x] NSArray,NSMutableArray,NSDictonary,NSMutableDictionary

  • [x] KVO

  • [x] Zombie Pointer

  • [x] NSTimer

  • [x] NSNotification

如何安装

pod 'JJException'

如何使用

  • 所有异常的分类,根据自身需要,自由组合

    typedef NS_OPTIONS(NSInteger,JJExceptionGuardCategory){
    JJExceptionGuardNone = 0,
    JJExceptionGuardUnrecognizedSelector = 1 << 1,
    JJExceptionGuardDictionaryContainer = 1 << 2,
    JJExceptionGuardArrayContainer = 1 << 3,
    JJExceptionGuardZombie = 1 << 4,
    JJExceptionGuardKVOCrash = 1 << 5,
    JJExceptionGuardNSTimer = 1 << 6,
    JJExceptionGuardNSNotificationCenter = 1 << 7,
    JJExceptionGuardAll = JJExceptionGuardUnrecognizedSelector | JJExceptionGuardDictionaryContainer | JJExceptionGuardArrayContainer | JJExceptionGuardZombie | JJExceptionGuardKVOCrash | JJExceptionGuardNSTimer | JJExceptionGuardNSNotificationCenter,
    };
  • 设置异常类型并开启

    [JJException configExceptionCategory:JJExceptionGuardAll];
    [JJException startGuardException];
  • 实时关闭保护

    [JJException stopGuardException];
  • Zombie使用黑名单机制,只有加入这个名单的才有作用,示例如下:

    [JJException addZombieObjectArray:@[TestZombie.class]];
  • 如果需要记录日志,只需要实现JJExceptionHandle协议,并注册:
    
    @interface ViewController ()<JJExceptionHandle>

@end

@implementation ViewController

  • (void)viewDidLoad {
    [super viewDidLoad];
    [JJException registerExceptionHandle:self];
    }

  • (void)handleCrashException:(NSString)exceptionMessage exceptionCategory:(JJExceptionGuardCategory)exceptionCategory extraInfo:(nullable NSDictionary)info{

}



## 工作原理

[JJException技术原理](https://github.com/jezzmemo/JJException/blob/master/JJExceptionPrinciple.md)

## TODO(大家记得给我星哦)
* 增加object dealloc的block支持,内部使用,外部也可以单独引用

## License
JJException is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "JJException",
    "version": "0.0.6",
    "summary": "Handle the objective-c crash exception.",
    "description": "JJException Handle the objective-c crash exception.",
    "homepage": "https://github.com/jezzmemo/JJException",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "u674eu6770": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/jezzmemo/JJException.git",
        "tag": "0.0.6"
    },
    "default_subspecs": "All",
    "subspecs": [
        {
            "name": "All",
            "ios": {
                "dependencies": {
                    "JJException/Swizzle": [],
                    "JJException/ARC": [],
                    "JJException/MRC": [],
                    "JJException/Main": []
                }
            }
        },
        {
            "name": "ARC",
            "requires_arc": true,
            "source_files": "JJException/Source/ARC/*.{h,m}",
            "dependencies": {
                "JJException/Swizzle": [],
                "JJException/Main": []
            }
        },
        {
            "name": "Swizzle",
            "requires_arc": true,
            "source_files": "JJException/Source/Swizzle/*.{h,m}"
        },
        {
            "name": "Main",
            "requires_arc": true,
            "public_header_files": "JJException/Source/Main/JJException.h",
            "source_files": "JJException/Source/Main/*.{h,m}"
        },
        {
            "name": "MRC",
            "requires_arc": false,
            "source_files": "JJException/Source/MRC/*.{h,m}",
            "dependencies": {
                "JJException/Swizzle": [],
                "JJException/Main": []
            }
        }
    ]
}

Pin It on Pinterest

Share This