ios -> 苹果审核 crash log 分析

来自 :  http://www.cnblogs.com/siasyl/p/7339013.html

 

参考文章:http://www.qingpingshan.com/rjbc/ios/230949.html

 

1.桌面新建一个文件夹,自行命名(crash);

2.找到Xcode的位置,右键"显示包内容",根据以下目录找到symbolicatecrash工具:

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash

 

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash,并拷贝出来,放到刚才创建的(crash)文件夹中;



 

3.把苹果审核返回的崩溃日志下载,也放到刚才创建的crash文件夹中;

4.打开Xcode,选择Window-->Orgianzer找到对应的Archive文件,



 

点击右边的Download dSYMS,



 

如果提示 No dSYMs were found for Version xxx Build xxx ,



 

可以右键点击对应的Archive文件,show in finder,然后右键显示包内容,找到dSYMs文件夹下的对应dYSMs文件,拷贝到刚才的文件夹下;



 

如果文件夹为空,那么就要去检查Xcode设置,在Xcode --> Build Setting 搜索 "debug information format",将"DWARF"修改为"DWARF with dSYM File",之后重新打包就可以找到了;



  

5.打开终端,进入刚才的文件夹(cd 你自己的刚才创建的文件夹路径)

1
cd /Users/xxx/desktop/crash 

6.接着输入以下命令

1
./symbolicatecrash ./crash.txt ./MyAppName.app.dSYM > crash. log
./symbolicatecrash ./1.txt ./MyAppName.app.dSYM > 1.crash

 

 

注:1.txt为苹果返回的崩溃日志的名字,MyAppName.app.dSYM为你自己拷出来的dSYM文件的名字,1.crash 为你要输出的日志文件的名字

执行命令之前的crash文件夹内(上面三个txt格式的为苹果返回的崩溃日志文件)



 

执行命令之后(.crash文件为生成的日志文件)



 

7.如果提示"DEVELOPER_DIR" is not defined at xxxxxxxxxxxxxx,那么输入以下命令,如果没有则跳过

1
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

8.然后重新输入第6步的命令

1
./symbolicatecrash ./crash.txt ./MyAppName.app.dSYM > crash. log

9.打开日志文件进行分析



 

 

10.根据提示找到SportMainController中的onReGeocodeSearchDone方法



 

 

11.发现是在else中截取字符串时出现问题,有可能字符串长度为0,这样substringToIndex:-1就导致程序崩溃了,加一个判断条件,问题解决



 

 

 

 

 

 

 

#ifndef MYSPDLOG_H #define MYSPDLOG_H #include <fstream> #include <iostream> #define SPDLOG_HEADER_ONLY #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #include "spdlog/spdlog.h" #include "spdlog/logger.h" #include "spdlog/sinks/basic_file_sink.h" #include "spdlog/sinks/rotating_file_sink.h" #include "spdlog/sinks/stdout_color_sinks.h" #include "spdlog/sinks/daily_file_sink.h" class MySpdlog { public: static MySpdlog*getInstace() { static MySpdlog MySpdlogStatic; return &MySpdlogStatic; } int init() { std::string formatStr="%Y-%m-%dT%H:%M:%S.%e[%l][%s:%#][%!]%v"; // auto myLogger1 = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("spdlog", "logs/myspdlog.log", 1024 * 1024 * 10, 10); // auto myLogger1 = std::make_shared<spdlog::sinks::daily_file_sink>("spdlog", "logs/log.txt", 0, 0); auto myLogger1 = spdlog::daily_logger_mt("spdlog", "logs/log.txt", 0, 0); // myLogger1 = spdlog::rotating_logger_mt("spdlog", "logs/myspdlog.log", 1024 * 1024 * 10, 10); spdlog::set_default_logger(myLogger1); myLogger1->set_level(spdlog::level::debug); myLogger1->set_pattern(formatStr); myLogger2 = spdlog::stdout_color_mt("baseLogger2"); spdlog::set_default_logger(myLogger2); myLogger2->set_level(spdlog::level::debug); myLogger2->set_pattern(formatStr); return 0; } void uninit() { } std::shared_ptr<spdlog::logger> myLogger1; std::shared_ptr<spdlog::logger> myLogger2; private: MySpdlog() {} ~MySpdlog() {} }; #define SPLOG_INIT() MySpdlog::getInstace()->init() #define SPLOG_UNINIT() MySpdlog::getInstace()->uninit() #define SPLOG_DEBUG(...) do {SPDLOG_LOGGER_DEBUG(MySpdlog::getInstace()->myLogger1, __VA_ARGS__);\ SPDLOG_LOGGER_DEBUG(MySpdlog::getInstace()->myLogger2, __VA_ARGS__);}while(0) #define SPLOG_INFO(...) do {SPDLOG_LOGGER_INFO(MySpdlog::getInstace()->myLogger1, __VA_ARGS__);\ SPDLOG_LOGGER_INFO(MySpdlog::getInstace()->myLogger2, __VA_ARGS__);}while(0) #define SPLOG_ERROR(...) do {SPDLOG_LOGGER_ERROR(MySpdlog::getInstace()->myLogger1, __VA_ARGS__);\ SPDLOG_LOGGER_ERROR(MySpdlog::getInstace()->myLogger2, __VA_ARGS__);}while(0) #define SPDLOG_CLRAR(a) do{std::fstream fout((a),std::ios::out|std::ios::trunc);fout.close();}while(0); #endif // MYSPDLOG_H运行之后调用SPLOG_INFO时报错
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值