Git Product home page Git Product logo

nfguarddog's Introduction

NFGuardDog

Version License Platform

APP的看门狗,基于runtime的Swizzle Method的crash防护框架,能实时捕获导致app崩溃的破坏因子并自动修复,保持应用的健壮性。

常见的crash

  • Unrecognized Selector Sent to Instance/class
  • 容器类的数组越界,key-value参数异常
  • KVO crash
    • 移除了未注册的观察者,导致崩溃
    • 重复移除多次,移除次数多于添加次数,导致崩溃
    • 观察者没有实现observeValueForKeyPath:导致崩溃
    • 添加keypath为空字符串时,导致崩溃
    • 添加或者移除时 keypath == nil,导致崩溃
  • KVC crash
    • key/keypath值不正确
    • 设置的值的类型不匹配
  • NSString,NSMutableString,NSAttributedString,NSMutableAttributedString(下标越界以及参数nil异常)
  • NSTimer(忘记invalidate ,导致内存泄漏)
  • 不在主线程刷新UI
  • NSNull 方法不存在
  • 野指针

功能

  • ✅ Unrecognized Selector crash
  • ✅ Container crash
  • ✅ KVO crash
  • ✅ KVC crash
  • ✅ NSString类族 Crash
  • ✅ NSTimer
  • ✅ NSNull

使用方法

  • 开启防止Crash组件
    //1. 启动所有避免crash组件
    [NFGuardDog startAvoidAllCrashWithdelegate:self];
    
     //2. 启动部分避免crash组件
    NFAvoidCrashType type = NFAvoidCrashTypeKVC | NFAvoidCrashTypeKVO;
    [NFGuardDog startAvoidCrash:type delegate:self];
    
    //3. 关闭组件
    [NFGuardDog stopAvoidCrash];
    
    //4. 实现NFAvoidCrashDelegate协议
    - (void)nf_handleAvoidCrashException:(NFCrashException *)exception{
        NSLog(@"🐞🐞🐞:you have a crash need to process,see upward⬆️");
        //To do: 你可以在这儿上传捕获的异常😎😎😎
    }

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

NFGuardDog is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NFGuardDog'

开发计划

  • ✅ AvoidCrash
  • ❎ 日志收集
  • ❎ FPS监控
  • ❎ crash收集
  • ❎ 流量监控

Author

JIANG PENGH CHENG, [email protected]

License

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

nfguarddog's People

Stargazers

JIANG PENGCHENG avatar

Watchers

James Cloos avatar JIANG PENGCHENG avatar

Forkers

haiwei-lee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.