麻烦追逐xcode堆栈跟踪

时间:2014-11-07 03:57:54

标签: ios xcode google-analytics-sdk

** 跳到此问题的底部以查找问题/解决方案 **

我刚刚将我的应用从GA 2.0转换为3.0。部分转化包括GAIDictionaryBuilder的合并。该应用程序正在运行,但很快就会在启动后崩溃。这是从开始到崩溃的xcode日志。底部有更多笔记。

2014-11-06 20:43:16.402 xxxxx[17769:2433378] VERBOSE: GoogleAnalytics 3.10 +[GAITrackerModel initialize] (GAITrackerModel.m:88): idfa class missing, won't collect idfa
[Allocator] Middle guard protection failed %d
[Allocator] Allocator invalid, falling back to malloc
2014-11-06 20:43:16.467 xxxxx[17769:2433378] bundle id: com.xxxxx.iphone-app
2014-11-06 20:43:16.523 xxxxx[17769:2433378] The internet is working via WWAN.
2014-11-06 20:43:16.524 xxxxx[17769:2433378] A gateway to the host server is working via WWAN.
2014-11-06 20:43:16.525 xxxxx[17769:2433430] Reachability: WR -t-----
2014-11-06 20:43:17.091 xxxxx[17769:2433378] INFO: GoogleAnalytics 3.10 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X040003
2014-11-06 20:43:17.091 xxxxx[17769:2433378] The internet is working via WWAN.
2014-11-06 20:43:17.092 xxxxx[17769:2433378] A gateway to the host server is working via WWAN.
2014-11-06 20:43:17.133 xxxxx[17769:2433378] registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
2014-11-06 20:43:17.152 xxxxx[17769:2433378] CACHE CHECK: messages.cached.xml, 2014-11-07 02:43:17 +0000, 2014-11-07 03:16:25 +0000, -1, -1, 1
2014-11-06 20:43:17.152 xxxxx[17769:2433378] Loading from archive messages.cached.xml
2014-11-06 20:43:17.156 xxxxx[17769:2433378] CACHE CHECK: featured.cached.xml, 2014-11-06 18:30:00 +0000, 2014-11-07 01:56:14 +0000, -1, -1, 1
2014-11-06 20:43:17.157 xxxxx[17769:2433378] Loading from archive featured.cached.xml
2014-11-06 20:43:17.203 xxxxx[17769:2433428] VERBOSE: GoogleAnalytics 3.10 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:497): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_u" = ".xxxxx";
        "&_v" = "mi3.1.0";
        "&a" = xxxxx;
        "&aid" = "com.xxxxx.iphone-app";
        "&an" = xxxxx;
        "&av" = "2.0";
        "&cd" = "/featured";
        "&cid" = "xxxxx";
        "&ds" = app;
        "&sr" = 320x568;
        "&t" = screenview;
        "&tid" = "xxxxx";
        "&ul" = en;
        "&v" = 1;
        "&z" = xxxxx;
        gaiVersion = "3.10";
        useSecure = 0;
    };
    timestamp = "2014-11-07 03:43:17 +0000";
}
2014-11-06 20:43:17.221 xxxxx[17769:2433378] setActiveContent title: (null)
2014-11-06 20:43:17.331 xxxxx[17769:2433378] Loading from archive 80.cached.jpg
2014-11-06 20:43:17.336 xxxxx[17769:2433378] Loading from archive 64.cached.jpg
2014-11-06 20:43:17.343 xxxxx[17769:2433378] Loading from archive 74.cached.jpg
2014-11-06 20:43:17.347 xxxxx[17769:2433378] Loading from archive 59.cached.jpg
2014-11-06 20:43:17.355 xxxxx[17769:2433378] Loading from archive 57.cached.jpg
2014-11-06 20:43:17.494 xxxxx[17769:2433378] -[GAIDictionaryBuilder objectForKey:]: unrecognized selector sent to instance 0x17027b340
2014-11-06 20:43:17.502 xxxxx[17769:2433378] WARNING: GoogleAnalytics 3.10 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:49): Uncaught exception: -[GAIDictionaryBuilder objectForKey:]: unrecognized selector sent to instance 0x17027b340
2014-11-06 20:43:17.560 xxxxx[17769:2433428] VERBOSE: GoogleAnalytics 3.10 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:497): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_u" = ".oyLo";
        "&_v" = "mi3.1.0";
        "&a" = xxxxx;
        "&aid" = "com.xxxxx.iphone-app";
        "&an" = xxxxx;
        "&av" = "2.0";
        "&cd" = "/featured";
        "&cid" = "xxxxx";
        "&ds" = app;
        "&exd" = "NSInvalidArgumentException\nTrace:\n<redacted>\n<redacted>\n_CF_forwarding_prep_0\n-[GAITrackerImpl gai_send:]\n-[AppDelegate applicationDidBecomeActive:]\n<";
        "&exf" = 1;
        "&sr" = 320x568;
        "&t" = exception;
        "&tid" = "xxxxx";
        "&ul" = en;
        "&v" = 1;
        "&z" = xxxxx;
        gaiVersion = "3.10";
        useSecure = 0;
    };
    timestamp = "2014-11-07 03:43:17 +0000";
}
2014-11-06 20:43:17.605 xxxxx[17769:2433428] VERBOSE: GoogleAnalytics 3.10 -[GAIRequestBuilder requestPostUrl:payload:compression:] (GAIRequestBuilder.m:167): building URLRequest for http://www.google-analytics.com/batch
2014-11-06 20:43:17.607 xxxxx[17769:2433428] VERBOSE: GoogleAnalytics 3.10 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:612): Sending hit(s) POST: http://www.google-analytics.com/batch
2014-11-06 20:43:17.807 xxxxx[17769:2433378] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:208): Hit(s) dispatched: HTTP status 200
2014-11-06 20:43:17.808 xxxxx[17769:2433428] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:509): hit(s) Successfully deleted
2014-11-06 20:43:17.811 xxxxx[17769:2433428] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:219): 2 hit(s) sent
2014-11-06 20:43:20.093 xxxxx[17769:2433378] Login response: true
2014-11-06 20:43:20.094 xxxxx[17769:2433378] auto login check: GOOD
2014-11-06 20:43:22.548 xxxxx[17769:2433378] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GAIDictionaryBuilder objectForKey:]: unrecognized selector sent to instance 0x17027b340'
*** First throw call stack:
(0x184189e48 0x19487c0e4 0x184190f14 0x18418dcc4 0x184092c1c 0x10023d314 0x1000ad71c 0x1889ba488 0x188bcb818 0x18c3ed640 0x184142124 0x18414122c 0x18413f850 0x18406d1f4 0x18d2035a4 0x18899e784 0x10014cac4 0x194eeaa08)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

我知道崩溃正在发生,因为有一个无法识别的选择器与GAIDictionaryBuilder某处使用但位置在哪里?我全都使用GAIDictionaryBuilder,用法总是一样的。有关我下一次故障排除的建议吗?

问题

[[[GAI sharedInstance] defaultTracker] send:[GAIDictionaryBuilder createEventWithCategory:@"General"
                                                                                   action:@"App Became Active"
                                                                                    label:nil
                                                                                    value:0]];

解决方案

我需要将build添加到GAIDictionaryBuilder

[[[GAI sharedInstance] defaultTracker] send:[[GAIDictionaryBuilder createEventWithCategory:@"General"
                                                                                   action:@"App Became Active"
                                                                                    label:nil
                                                                                    value:0] build]];

1 个答案:

答案 0 :(得分:2)

首先尝试添加例外断点。

Link

您也可以尝试使用@try @catch块并尝试捕获错误(可能会捕获您在代码中使用的集中方法 - 如果有的话)。

此外,在您的代码中,您可以先使用respondsToSelector:

询问自己是否尝试访问该方法

这些都来自我的头脑。如果您提供进一步的信息,我会尝试回复更新。