Giter Site home page Giter Site logo

crashdemo's Introduction

CrashDemo

自己写代码捕获异常信息,将捕获到的异常信息在下次联网的时候发给后

1)将UncaughtExceptionHandler1.h UncaughtExceptionHandler1.m 文件拖到项目中

2)AppDelegate.m 中

#import "UncaughtExceptionHandler1.h"

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. //调用这个函数就可以收集崩溃信息 InstallUncaughtExceptionHandler();

    return YES; }

3)ViewController.m中 [dict setObject:nil forKey:@"kong"];制造崩溃信息

  • (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSMutableDictionary *dict = [NSMutableDictionary dictionary]; //这里打开就可以看到控制台输出异常信息 // [dict setObject:nil forKey:@"kong"]; }

4)异常信息输出

2016-04-26 11:53:53.941 CrashDemo[1758:465788] 异常信息

*** setObjectForKey: object cannot be nil (key: kong)( "4 libc++abi.dylib 0x0000000197e72f44 + 16", "5 libc++abi.dylib 0x0000000197e72b10 __cxa_rethrow + 144", "6 libobjc.A.dylib 0x00000001987e4120 objc_exception_rethrow + 44", "7 CoreFoundation 0x0000000183b14d48 CFRunLoopRunSpecific + 552", "8 UIKit 0x00000001892321c8 + 460" )

crashdemo's People

Stargazers

 avatar nacker avatar  avatar  avatar  avatar Boffy avatar  avatar zhaoweicheng avatar wg avatar

Watchers

James Cloos avatar wg avatar

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.