Latest 1.2.0
Homepage https://github.com/chuqingr/CHUncaughtExceptionHandler
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

Example

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

Requirements

Installation

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

pod 'CHUncaughtExceptionHandler'

Use

OC

#import <CHUncaughtExceptionHandler/CHUncaughtExceptionHandler.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[CHUncaughtExceptionHandler defaultManager] installUncaughtExceptionHandler:YES];
    return YES;
}

/// log记录
debugLog(@"%@",@"这是一个会被记录的日志");

Swift

CHUncaughtExceptionHandler.defaultManager().installUncaughtExceptionHandler(true)

func debugLog(_ items: Any) {
    debugPrint(items)
    #if DEBUG
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "saveLog"), object: nil, userInfo: ["log":items])
    #endif
}
因swift无法直接调用OC的宏定义,所以自定义一个方法,实现一样的log记录功能

如出现崩溃,会出现拦截,进行提示,信号的崩溃无法拦截。
崩溃的信息会被记录在文件中,可通过
[NSNotificationCenter.defaultCenter postNotificationName:@"checkLog" object:nil];
唤出日志界面

Author

杨胜浩, [email protected]

License

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

Latest podspec

{
    "name": "CHUncaughtExceptionHandler",
    "version": "1.2.0",
    "summary": "UncaughtExceptionHandler & Log",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/chuqingr/CHUncaughtExceptionHandler",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "u6768u80dcu6d69": "[email protected]"
    },
    "source": {
        "git": "https://github.com/chuqingr/CHUncaughtExceptionHandler.git",
        "tag": "1.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "CHUncaughtExceptionHandler/Classes/**/*",
    "public_header_files": "CHUncaughtExceptionHandler/Classes/CHUncaughtExceptionHandler.h"
}

Pin It on Pinterest

Share This