Trying to squash one of our more persistent crash reports. Suspicious because it's exclusively iOS 7.*, it's not clear what the trigger is, and this is a relatively small percentage of our users encountering the issue. Feels like a race condition or iOS 7.* specific bug with Google Analytics SDK. My interactions with the SDK are straight forward:
+ (void)trackEvent:(NSString *)category action:(NSString *)action label:(NSString *)label value:(NSNumber *)value
{
// May return nil if a tracker has not already been initialized with a
// property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:category
action:action
label:label
value:value] build]];
}
+ (void)trackScreenView:(NSString *)screenName
{
// https://developers.google.com/analytics/devguides/collection/ios/v3/screens
// May return nil if a tracker has not already been initialized with a
// property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to nil.
[tracker set:kGAIScreenName
value:screenName];
// Previous V3 SDK versions
// [tracker send:[[GAIDictionaryBuilder createAppView] build]];
// New SDK versions
[self visuallyLogTrackingDetails:tracker dictionaryBuilder:[GAIDictionaryBuilder createScreenView]];
}
There are also cases where I pass more data to the call (in addition to screen name), e.g.:
+ (void)trackGenderedScreenView:(MyAppGender)gender
{
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName
value:MyAppAnalyticsGenderedScreenName];
GAIDictionaryBuilder *dictionaryBuilder = [GAIDictionaryBuilder createScreenView];
[dictionaryBuilder set:[MyAppUtil getGenderedString:gender]
forKey:[GAIFields customDimensionForIndex:ASPAnalyticsDimensionGender]];
[self visuallyLogTrackingDetails:tracker dictionaryBuilder:dictionaryBuilder];
}
SDK Version: Google Analytics Services iOS 3.10
Impact: Limited to iOS 7.*.
Sample Stack Trace
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x000000019333258c __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001933b516c pthread_kill + 104
2 libsystem_c.dylib 0x00000001932c6808 abort + 112
3 libc++abi.dylib 0x00000001924ec994 __cxa_bad_cast
4 libc++abi.dylib 0x0000000192509c2c default_unexpected_handler()
5 libobjc.A.dylib 0x0000000192c444d4 _objc_terminate() + 128
6 libc++abi.dylib 0x0000000192507168 std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x0000000192506a80 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8 libobjc.A.dylib 0x0000000192c44318 _objc_exception_destructor(void*)
9 CoreFoundation 0x000000018673e890 -[NSException initWithCoder:]
10 Foundation 0x00000001872286a8 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 236
11 Foundation 0x00000001872281ac -[NSISEngine optimize] + 188
12 Foundation 0x000000018722384c -[NSISEngine withBehaviors:performModifications:] + 232
13 UIKit 0x0000000189827488 -[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 228
14 UIKit 0x000000018978ac78 -[UIWindow(UIConstraintBasedLayout) layoutSublayersOfLayer:] + 92
15 QuartzCore 0x00000001892f4258 -[CALayer layoutSublayers] + 184
16 QuartzCore 0x00000001892eee20 CA::Layer::layout_if_needed(CA::Transaction*) + 300
17 QuartzCore 0x00000001892eecd8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
18 QuartzCore 0x00000001892ee560 CA::Context::commit_transaction(CA::Transaction*) + 280
19 QuartzCore 0x00000001892ee304 CA::Transaction::commit() + 424
20 QuartzCore 0x00000001892e7c38 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
21 CoreFoundation 0x00000001866ff0a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
22 CoreFoundation 0x00000001866fc330 __CFRunLoopDoObservers + 372
23 CoreFoundation 0x00000001866fc6bc __CFRunLoopRun + 764
24 CoreFoundation 0x000000018663d6d0 CFRunLoopRunSpecific + 452
25 MyApp 0x000000010051ff84 GAIUncaughtExceptionHandler
26 CoreFoundation 0x000000018673ece8 __handleUncaughtException + 644
27 libobjc.A.dylib 0x0000000192c444c8 _objc_terminate() + 116
28 libc++abi.dylib 0x0000000192507168 std::__terminate(void (*)()) + 16
29 libc++abi.dylib 0x00000001925071d8 std::terminate() + 64
30 libobjc.A.dylib 0x0000000192c4442c _destroyAltHandlerList
31 libdispatch.dylib 0x000000019321bfe8 _dispatch_client_callout + 36
32 libdispatch.dylib 0x000000019321f1dc _dispatch_main_queue_callback_4CF + 336
33 CoreFoundation 0x00000001866fe62c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
34 CoreFoundation 0x00000001866fc96c __CFRunLoopRun + 1452
35 CoreFoundation 0x000000018663d6d0 CFRunLoopRunSpecific + 452
36 GraphicsServices 0x000000018c321c0c GSEventRunModal + 168
37 UIKit 0x000000018976efdc UIApplicationMain + 1156
38 MyApp 0x0000000100156a48 main (main.m:14)
39 libdyld.dylib 0x0000000193237aa0 start + 4
By reading crash report , i have noticed that there is a problem with layout constraints. I have also faced similar kind of issues in iOS 7 because of layout constraints. Problem could be using proportionate width/height auto layout constraints as these are not working properly in iOS 7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With