4

**跳到这个问题的底部找到问题/解决方案**

我刚刚将我的应用程序从 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]];

解决方案

我需要添加buildGAIDictionaryBuilder

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

1 回答 1

2

尝试先添加异常断点。

关联

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

此外,在您的代码中,您可以先问自己是否尝试通过使用访问的方法respondsToSelector:

这些都是我的想法。如果您提供更多信息,我会尽力回复更新。

于 2014-11-07T04:09:41.647 回答