首页 > 编程知识 正文

serial console,crash against

时间:2023-05-03 06:57:07 阅读:62663 作者:4935

Crash Report手机可以直接从iPhone设备上提取,也可以从iTunes上下载,但这两种方法都不起作用。 用户的设备不能随时提供给你。 用户也不一定会将Crash Report上传到iTunes。 如果是这样,在APP中自己收集Crash Report,通过互联网或互联网

介绍crash report收集的第三方框架PLCrashReporter

下载地址: https://www.plcrashreporter.org/download

解压缩并打开文件夹后,将在Source文件下找到iOS版本的demo。 demo版本太早,iOS9可能无法正常工作,需要进行一些修改

demo的源代码如下。

-(void ) init views (内存警告reached=no; //overridepointforcustomizationafterapplaunch [ windowaddsubview 3360 view controller.view ]; [ window makekeyandvisible ]//thisfunctionssendsthecrashdatatotheserver-(void ) sendcrashreport ([ windowaddsubview 3360 sherathed 3360 startupviewcontroller [ startupviewcontrollerstartcrashdata ] }您可以修改以下内容:

-(void ) init views (内存警告reached=no; //overridepointforcustomizationafterapplaunch//window.rootviewcontroller=[ uiviewcontrollernew ]; //[ windowaddsubview 3360 view controller.view ] window.rootview controller=view controller; “window makekeyandvisible (//thisfunctionssendsthecrashdatatotheserver-(void ) sendcrashreport (//[ windowaddsubvied ] [ startupviewcontrollerstartcrashdata ] } demo已打印了crash report的基本信息并已上传到服务器,可以对其进行修改

- (void ) handleCrashReport方法将crash report信息另存为. plcrash或. crash文件,然后通过http上载到我们的服务器或其他操作等。 修改如下。

-(void ) handlecrashreport { plcrashreporter * crash reporter=[ plcrashreportersharedreporter ]; NS数据* Crash数据; ns错误错误*错误; //tryloadingthecrashreportcrashdata=[ crashreporterloadpendingcrashreportdataandreturnerror ]; if(crashdata==nil ) ns log (@ ' couldnotloadcrashreport : % @ ',error ); [ crashreporterpurgependingcrashreport ] return; } ns string * docpath=[ nssearchpathfordirectoriesindomains (nsdocumentdirectory,NSUserDomainMask,是)第一对象] ns [ crashdatawritetofile 3360文件路径ath atomically : yes ]//we could send the report from here, but we ' lljustprintout//somedebugginginfoinsteadplcrashreport * report=[ plcrashreport ] if (report==nil ) ns log (@ [ crashreporterpurgependingcrashreport ] return; }nslog(@'crashedon%@ ',report.systemInfo.timestamp ); slog (@ ' crashedwithsignal % @ (代码% @,address=0x%' PRIx64 ' ),report.signalInfo.name, report.signalinfference ns string * human text=[ plcrashreporttextformatterstringvalueforcrashreport 3360 reportwithtextformat 3360 plcrashreporttextformat [ humanted string encoding ] write to file : [ docpathstringbyappendingpathcomponent 3360 @ ' d ]//purgethereport [ crashreporterpurgeppont 返回; }然后分析. crash或. plcrash文件。

稍后将介绍具体分析。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。