zoukankan      html  css  js  c++  java
  • ios获取crash信息

    在程序启动代理内加入如下代码:
    NSString *applicationDocumentsDirectory() 
    {
    return  [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 
    
    }
    
    void UncaughtExceptionHandler(NSException *exception) 
    { 
    
    NSArray *arr = [exception callStackSymbols]; NSString *reason = [exception reason];
    NSString *name = [exception name];
    
    NSString *path = [applicationDocumentsDirectory() stringByAppendingPathComponent:@"Exception.txt"];
    [urlStr writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil]; 
    }
    
    在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 里添加如下:
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *path = [applicationDocumentsDirectory() stringByAppendingPathComponent:@"Exception.txt"]; if([fileManager fileExistsAtPath:path]){
    NSString *str = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; //读取crash信息 //需要做什么处理在这处理就可以,比如信息上传,
    }
    
    [fileManager removeItemAtPath:path error:nil]; //信息处理完事以后进行删除
    NSSetUncaughtExceptionHandler (&UncaughtExceptionHandler);
  • 相关阅读:
    HDFS DataNode 多目录
    HDFS DataNode 退役 旧节点
    HDFS DateNoda 服役 新节点
    HDFS DataNode 时限参数设置
    HDFS NameNode 多目录
    HDFS 安全模式
    HDFS NameNode故障排除
    HDFS CheckPoint时间设置
    HDFS NameNode和SecondaryNameNode
    微信小程序:上拉加载更多
  • 原文地址:https://www.cnblogs.com/leeAsia/p/3363859.html
Copyright © 2011-2022 走看看