大佬教程收集整理的这篇文章主要介绍了iphone – 当应用程序崩溃时,如何将崩溃报告发送到Web服务?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
下载crashManagetLib以阅读崩溃报告.
您可以在didFinishLaunchingWithOptions中编写崩溃读取代码,例如: –
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self checkCrash]; } // To check Crash and attach the crash file to Email - (void) checkChrash { //code for the application crash report. NSFileManager *file = [NSFileManager defaultManager]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *dir = [paths objectATindex:0]; NSString *errorReportPath = [[dir StringByAppendingPathComponent:@"crash_report.plcrash"] retain]; //Call Crash Manager if apps is crashed [[CrashManager sharedInstance] manageCrashes]; [[CrashManager sharedInstance] setCrashDelegate:self SELEctor:@SELEctor(notifyException:stackTrace:)]; //Mail Dialog is display if apps is crashed NSString* errorReport = [CrashManager sharedInstance].errorReport; if ([file fileExistsAtPath:errorReportPath]) { if(nil != errorReport) { // log out from facebook. [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"TOKEN"]; NSString *crashResponce = [BKAPIClient sendCrashReportBymethod:aCrashReport WithErrorLog:errorReport]; NSLog(@"%@",crashResponcE); if ([crashResponce isEqualToString:@"True"]) { NSLog(@"Crash Report has been sent !"); } [file removeItemAtPath:errorReportPath error:nil]; } } [errorReportPath release]; } // For stack trace of crash - (void) notifyException:(NSException*) exception stackTrace:(NSArray*)stackTrace { // Oh no! We crashed! // Time to output some stuff to the console. // Note: Any EXC_BAD_ACCESS crashes (such as accessing a deallocated object) will // cause the app to close stdout,so you won't see this trace in such a case. NSLog(@"Exception:\n%@\n",exception); NSLog(@"Full Trace:\n%@\n",[[StackTracer sharedInstance] printableTrace:stackTrace]); NSArray* intelligentTrace = [[StackTracer sharedInstance] intelligentTrace:stackTrace]; NSLog(@"Condensed Intelligent Trace:\n%@",[[StackTracer sharedInstance] condensedPrintableTrace:intelligentTrace]); }
以上是大佬教程为你收集整理的iphone – 当应用程序崩溃时,如何将崩溃报告发送到Web服务?全部内容,希望文章能够帮你解决iphone – 当应用程序崩溃时,如何将崩溃报告发送到Web服务?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。