Google Analytics in IOS(五)—— 崩溃和异常
来源:互联网 发布:php多久能学会 编辑:程序博客网 时间:2024/05/19 00:09
这是官方文档的,应该算译文了,如有错误,欢迎指正。
崩溃和异常测量允许你测量在你spp中崩溃和异常的类型及数量。GA中的异常由下面构成:
NSString
(Optional) Description – a description of the exception (up to 100 characters). Acceptsnil
.boolean
isFatal – indicates whether the exception was fatal.YES
indicates fatal.
Caught Exceptions(捕获的异常)
捕获的异常是你在程序中定义的异常处理代码中的错误。这些是你在在正常使用你的程序时可预见的会发生的错误。你期望应用程序能从其中恢复,比如在请求数据时偶尔网络超时。你可以添加sendException:到catch块的异常处理代码中来测量异常。在下面的例子中,一个程序尝试从云端拉取高分列表,如果请求超时,可能是由于速度较慢的网络连接,我们将在用户处理之前发送异常谷歌分析。
@try { NSArray *highScores=[self getHighScores];}@catch (NSException*exception){ [tracker sendException:NO// Boolean indicates non-fatal exception. withDescription:@"Connection timout %d: %@", connectionError, errorDescription];}
你可以用usingsendException:withDescription:withNSException:方法用异常的名臣和原因来自动填充描述(description)。如下面的例子:
@try{ NSArray *highScores=[self getHighScores];}@catch (NSException*exception){ [tracker sendException:NO withNSException:exception);}
Uncaught Exception Measurement
未捕获的异常表现在你的程序在运行时遇到未知情况,并且通常是致命的引起程序崩溃的结果。
设置sendUncaughtExceptions属性为YES,未捕获的异常可以自动发送到GA。这个可以很方便的在你的应用程序代理方法application:didFinishLaunchingWithOptions中设置:
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { [GAI sharedInstance].sendUncaughtExceptions= YES;// Enable // ... the rest of your code, include other GAI properties you want to set.}
当使用自动异常测量,要牢记以下几点:
- Google Analytics in IOS(五)—— 崩溃和异常
- Google Analytics in IOS(三)—— 电子商务追踪
- Google Analytics in IOS(四)—— 高级配置
- Google Analytics in IOS(六)—— 社交
- Google Analytics in IOS(二)——实现页面统计和事件追踪
- Google Analytics in IOS(一)—— 什么是谷歌分析
- Google Analytics自定义异常格式
- iOS-iOS异常捕获和崩溃日志
- Google Analytics功能篇—高级过滤器
- Google Analytics功能篇—事件追踪
- Google Analytics(分析)
- iOS版Google Analytics(分析)SDK v3 - 使用入门
- iOS Google Analytics(谷歌分析)开发
- 利用Google Analytics Api 获取数据——Google-api-python-client配置问题(一)
- 利用Google Analytics Api 获取数据——Google-api-python-client配置问题(二)
- Google Analytics in ADF using javascript
- 使用Google Analytics跟踪捕获JavaScript,AngularJS,jQuery的在线错误和异常
- 使用Google Analytics跟踪捕获JavaScript,AngularJS,jQuery的在线错误和异常
- 【人在运维囧途_02】20个Linux系统内置监视工具: vmstat 和 netstat
- 聚类算法
- linux ifconfig命令参数及用法详解--linux查看配置网卡命令
- php cURL库
- TCP/IP 不可配置参数
- Google Analytics in IOS(五)—— 崩溃和异常
- 设计原汁原味的 Windows Phone 应用
- 跑腿的
- 勘误表
- 题目1060:完数VS盈数
- 利用dom4j生成XML
- 杀掉带锁的Oracle进程
- Java和Android学习中的一些资源(网络搜集)
- C-DOCSIS安全性