您好我在Google Analytics
之一使用了iPhone app
。我正在跟踪应用安装,屏幕访问和点击事件。
现在,我想跟踪应用程序中crashes & exceptions
的原因及其位置(按位置,我的意思是方法名称,行号或其他任何内容)。我已阅读谷歌提供的文件,但没有得到任何有用的信息。
任何人都可以帮我这个吗?任何一个例子都会非常感激。
更新: - 此处,我附上了GA信息中心的屏幕截图链接。
答案 0 :(得分:7)
您可以发送回溯(已经过符号化)。 我设置sendUncaughtExceptions = FALSE并手动发送。
id tracker = [[GAI sharedInstance] defaultTracker];
NSString * model = [[UIDevice currentDevice] model];
NSString * version = [[UIDevice currentDevice] systemVersion];
NSArray * backtrace = [exception callStackSymbols];
NSString * description = [NSString stringWithFormat:@"%@.%@.%@.Backtrace:%@",
model,
version,
exception.description,
backtrace];
[tracker send:[[GAIDictionaryBuilder
createExceptionWithDescription:description // Exception description. May be truncated to 100 chars.
withFatal:NO] build]];
(型号和版本是可选的)
回溯将具有<编辑>但最重要的类和方法将是符号(崩溃发生的地方),你会知道在哪里
**编辑**
如何处理异常
答案 1 :(得分:1)
我尚未使用Google Analytics崩溃报告功能,但found this可能会有所帮助。
您可以使用Google Analytics(v2)报告未捕获的异常,即使用此代码崩溃
- (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.
}
我不认为这些将是符号化崩溃报告,因为设备无法对其进行符号化。因此,您可能需要自己对收到的崩溃报告进行符号化,以了解导致此崩溃的代码中的行号。
查看Where can I view the Google Analytics iOS crash logs?
参考:Symbolicating iPhone App Crash Reports
希望有所帮助!
答案 2 :(得分:0)
Swift 3
GAI.sharedInstance().trackUncaughtExceptions = true