当前位置: 首页 > news >正文

办公门户网站模板下载中国建设银行手机银行app下载

办公门户网站模板下载,中国建设银行手机银行app下载,家具设计用什么软件最好,上海培训机构排名榜如果你去4S店修车#xff0c;给小工说你的车哪天怎么样怎么样了#xff0c;小工有可能会立即搬出一台电脑#xff0c;插上行车电脑把日志打出来#xff0c;然后告诉你你的车发生过什么故障。汽车尚且如此#xff0c;何况移动互联网应用呢。 本文第一篇#xff1a;经营你的…如果你去4S店修车给小工说你的车哪天怎么样怎么样了小工有可能会立即搬出一台电脑插上行车电脑把日志打出来然后告诉你你的车发生过什么故障。汽车尚且如此何况移动互联网应用呢。 本文第一篇经营你的iOS应用日志一开始编写日志组件   言归正传。开发iOS应用解决Crash问题始终是一个难题。Crash分为两种一种是由EXC_BAD_ACCESS引起的原因是访问了不属于本进程的内存地址有可能是访问已被释放的内存另一种是未被捕获的Objective-C异常NSException导致程序向自身发送了SIGABRT信号而崩溃。其实对于未捕获的Objective-C异常我们是有办法将它记录下来的如果日志记录得当能够解决绝大部分崩溃的问题。这里对于UI线程与后台线程分别说明。 先看UI线程。iOS SDK提供了NSSetUncaughtExceptionHandler函数用法如 NSSetUncaughtExceptionHandler( handleRootException ); 这样在UI线程发生未捕获异常后进程崩溃之前handleRootException会被执行。这个函数实现如下 static void handleRootException( NSException* exception ){ NSString* name [ exception name ]; NSString* reason [ exception reason ]; NSArray* symbols [ exception callStackSymbols ]; // 异常发生时的调用栈 NSMutableString* strSymbols [ [ NSMutableString alloc ] init ]; // 将调用栈拼成输出日志的字符串 for ( NSString* item in symbols ) { [ strSymbols appendString: item ]; [ strSymbols appendString: \r\n ]; }// 写日志级别为ERROR writeCinLog( __FUNCTION__, CinLogLevelError, [ Uncaught Exception ]\r\nName: %, Reason: %\r\n[ Fe Symbols Start ]\r\n%[ Fe Symbols End ], name, reason, strSymbols ); [ strSymbols release ];// 这儿必须Hold住当前线程等待日志线程将日志成功输出当前线程再继续运行 blockingFlushLogs( __FUNCTION__ );// 写一个文件记录此时此刻发生了异常。这个挺有用的哦 NSDictionary* dict [ NSDictionary dictionaryWithObjectsAndKeys: currentCinLogFileName(), LogFile, // 当前日志文件名称 currentCinLogFileFullPath(), LogFileFullPath, // 当前日志文件全路径 [ NSDate date ], TimeStamp, // 异常发生的时刻 nil ]; NSString* path [ NSString stringWithFormat: %/Documents/, NSHomeDirectory() ]; NSString* lastExceptionLog [ NSString stringWithFormat: %LastExceptionLog.txt, path ]; [ dict writeToFile: lastExceptionLog atomically: YES ];} 而我们的日志组件必须实现blockingFlushLogs函数确保进程在日志完全写入文件后再退出。这个实现应该很简单吧。 当应用下次启动时我们可以检查如果有LastExceptionLog.txt则弹窗引导测试人员将日志发过来。如果iPhone上面配置了EMail帐户可以很简单的调用MFMailComposeViewController将日志文件作为附件发送当然也可以想其它办法。 记得正式发布的版本要将它条件编译去掉哦。 其中文件中的最后一条ERROR即为导致崩溃的异常而从ERROR之前的日志可以看出当前程序的运行情况。ERROR如下 - 03-20 17:21:43 ERROR - [UI] -[CinUIRunLoopActionManager(Protected) handleRootException:][ Uncaught Exception ]Name: NSDestinationInvalidException, Reason: *** -[CinThreadRunLoopActionManager performSelector:onThread:withObject:waitUntilDone:modes:]: target thread exited while waiting for the perform[ Fe Symbols Start ]0 CoreFoundation 0x340c88d7 __exceptionPreprocess 1861 libobjc.A.dylib 0x343181e5 objc_exception_throw 322 CoreFoundation 0x340c87b9 [NSException raise:format:] 03 CoreFoundation 0x340c87db [NSException raise:format:] 344 Foundation 0x35a12493 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] 9985 Foundation 0x35a3afb5 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] 1086 MyiOSapplication 0x0022b7e9 -[CinThreadRunLoopActionManager(Protected) performAction:] 14413 UIKit 0x374b36b5 -[UIViewController _setViewAppearState:isAnimating:] 14414 UIKit 0x374b38c1 -[UINavigationController viewWillAppear:] 28815 UIKit 0x374b36b5 -[UIViewController _setViewAppearState:isAnimating:] 14416 UIKit 0x3750e61b -[UIViewController beginAppearanceTransition:animated:] 19017 UIKit 0x3750b415 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] 18418 UIKit 0x3750b357 -[UITabBarController transitionFromViewController:toViewController:] 3019 UIKit 0x3750ac91 -[UITabBarController _setSelectedViewController:] 30020 UIKit 0x3750a9c5 -[UITabBarController setSelectedIndex:] 24021 MyiOSapplication 0x0007ef1d [Utility ResetCurrentTabIndex] 17222 MyiOSapplication 0x001a87bd -[UIViewController(statusBar) dismissModalViewControllerAnimatedEx:] 41623 MyiOSapplication 0x001793fb -[ImageProcessingViewController save:] 69024 CoreFoundation 0x34022435 -[NSObject performSelector:withObject:withObject:] 5225 UIKit 0x3748c9eb -[UIApplication sendAction:to:from:forEvent:] 6226 UIKit 0x3748c9a7 -[UIApplication sendAction:toTarget:fromSender:forEvent:] 3027 UIKit 0x3748c985 -[UIControl sendAction:to:forEvent:] 4428 UIKit 0x3748c6f5 -[UIControl(Internal) _sendActionsForEvents:withEvent:] 49229 UIKit 0x3748d02d -[UIControl touchesEnded:withEvent:] 47630 UIKit 0x3748b50f -[UIWindow _sendTouchesForEvent:] 31831 UIKit 0x3748af01 -[UIWindow sendEvent:] 38032 UIKit 0x374714ed -[UIApplication sendEvent:] 35633 UIKit 0x37470d2d _UIApplicationHandleEvent 580834 GraphicsServices 0x308a3df3 PurpleEventCallback 88235 CoreFoundation 0x3409c553 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ 3836 CoreFoundation 0x3409c4f5 __CFRunLoopDoSource1 14037 CoreFoundation 0x3409b343 __CFRunLoopRun 137038 CoreFoundation 0x3401e4dd CFRunLoopRunSpecific 30039 CoreFoundation 0x3401e3a5 CFRunLoopRunInMode 10440 GraphicsServices 0x308a2fcd GSEventRunModal 15641 UIKit 0x3749f743 UIApplicationMain 109042 MyiOSapplication 0x000d4ccb main 17443 MyiOSapplication 0x000039c8 start 40[ Fe Symbols End ] 可以看到即使我们没有编译时生成的符号文件也能够打印出调用栈上的每个函数的名称只是没有文件名和行号。 那么除了UI线程之外自己创建的后台线程呢运行NSRunLoop的后台线程的线程函数应该如下 - ( void ) threadProc: ( NSString* )threadName{ NSThread* current [ NSThread currentThread ]; [ current setName: threadName ]; NSAutoreleasePool *pool [ [ NSAutoreleasePool alloc ] init ];// 一个没有实际作用的NSTimer确保NSRunLoop不退出。不知道有没有更好的办法啊 _dummyTimer [ [ NSTimer timerWithTimeInterval: 10.0 target: self selector: selector( dummyTimerProc: ) userInfo: nil repeats: YES ] retain ]; NSRunLoop *r [ NSRunLoop currentRunLoop ]; [ r addTimer: _dummyTimer forMode: NSDefaultRunLoopMode ];try {// 启动后台线程的NSRunLoop [ r run ]; }catch ( NSException *exception ) { [ self handleRootException: exception ];// 一旦在线程根上捕捉到未知异常记录异常后本线程退出 }finally { [ _dummyTimer invalidate ]; [ _dummyTimer release ]; [ pool release ]; }} 后台线程的handleRootException与UI线程基本一致。不过为了测试人员更加方便其实只要不是UI线程发生未捕获异常都可以先引导用户发送日志再把进程崩溃掉。  转载于:https://www.cnblogs.com/alario/archive/2012/03/28/2421574.html
http://www.pierceye.com/news/377114/

相关文章:

  • 有没有做美食的网站深圳网站建站公司
  • 学校网站建设需求分析调研表网站右侧信息跟随左侧菜单栏变化
  • 家乡网站建设策划案邢台哪里建网站
  • 网站建设实习收获青岛网上房地产网站
  • 简述电子政务网站设计的技术企业邮箱是什么类型的账户
  • 深圳网站建设公司元嘉定网站开发
  • 佛山外贸网站建设平台上传网站安装教程
  • c2c网站建设实例德国网站建设
  • 建网站支持设备是什么意思佛山中小企业网站建设
  • 网站建设与管理读后感宁德住房和城乡建设部网站
  • 贸易网站建站建设部网站社保联网
  • 住房城乡建设厅网站准考证如何建小企业网站
  • 葫芦岛市城乡建设局网站做什么样的网站
  • 铜山区规划建设局网站大学生心理咨询网站建设论文
  • 泸州本地网站建设扬州做网站公司
  • 镇江网站建设工作室怎么购买国外的域名
  • 广西南宁电商网站建设找客户信息的软件
  • 信阳网站开发公司2022中国互联网公司市值排名
  • 巨鹿县住房与城乡建设厅网站wordpress内容付费插件
  • 网站设计建设维护wordpress 仿搜狗百科
  • 做网站写的代号好跟不好的区别中国500强企业官网
  • html个人网站wordpress 后台 字数统计
  • 网站开发包括哪些技术网站后台框架模版
  • 济南地产行业网站开发长春网络推广
  • 网站建设全程揭秘网站建设费能抵扣吗
  • 网站开发用什么语言最安全网站的ftp在哪里可以查到
  • 物理结构网站我国网站建设现状
  • 毕设如何做网站tk网站免费
  • 做logo的著名网站一起做网商网站怎么样
  • 楼盘销售管理网站开发资源网站界面设计形考