question

amyhametov avatar image
amyhametov asked

Crash in [AIAmazonInsights insightsWithCredentials:withOptions:]

We have integrated A/B Testing service in our iOS app for doing some a/b experiments. For initialization we use this code: id options = [AIAmazonInsights optionsWithAllowEventCollection:YES withAllowWANDelivery:YES]; id credentials = [AIAmazonInsights credentialsWithApplicationKey: AMAZON_AB_PUBLIC_KEY withPrivateKey: AMAZON_AB_PRIVATE_KEY]; _abAmazonInsights = [AIAmazonInsights insightsWithCredentials:credentials withOptions:options]; But now we have a lot of crashes in our app with this stack trace: 1 CoreFoundation __exceptionPreprocess + 132 2 libobjc.A.dylib objc_exception_throw + 56 3 CoreFoundation -[__NSDictionaryM setObject:forKey:] + 968 4 SomeApp -[AIDefaultEventClient initWithContext:withDeliveryClient:allowsEventCollection:] + 668 5 SomeApp +[AIDefaultEventClient eventClientWithContext:withDeliveryClient:allowsEventCollection:] + 108 6 SomeApp -[AIAmazonInsights initInstanceWithContext:withOptions:withCompletionBlock:] + 380 7 SomeApp +[AIAmazonInsights insightsWithContext:withOptions:withCompletionBlock:] + 248 8 SomeApp +[AIAmazonInsights insightsWithCredentials:withOptions:withSettings:withCompletionBlock:] + 264 9 SomeApp +[AIAmazonInsights insightsWithCredentials:withOptions:] + 132 10 SomeApp -[SAApplicationController abInit] (SAApplicationController.m:213) 11 SomeApp __42-[SAAppDelegate appActivateFromBackgound:]_block_invoke (SAAppDelegate.m:757) 12 SomeApp __66-[RKObjectRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke232 (RKObjectRequestOperation.m:474) 13 libdispatch.dylib _dispatch_call_block_and_release + 20 14 libdispatch.dylib _dispatch_client_callout + 12 15 libdispatch.dylib _dispatch_main_queue_callback_4CF + 928 16 CoreFoundation CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 8 17 CoreFoundation __CFRunLoopRun + 1488 18 CoreFoundation CFRunLoopRunSpecific + 392 19 GraphicsServices GSEventRunModal + 164 20 UIKit UIApplicationMain + 1484 21 SomeApp main (main.m:14) 22 libdyld.dylib start + 0 It crashes on initialization for AIAmazonInsights, but on our test devices we can't reproduce this crash. What we do wrong? Or may be there are some bugs in A/B Testing SDK for iOS? We use AmazonInsights SDK 2.1.17.0 and have about 50 thousands crashes from 4 million users per day.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

DougM@Amazon avatar image
DougM@Amazon answered
Hello, Our recommendation would be to remove the AmazonInsights initialization command from the result block of your RestKit call and moving it to be a direct call within your AppDelegate's appDidFinishLaunching call or to have a flag that gets set specifically when the Insights SDK is initialized and check on that variable prior to doing something with our A/B testing SDK. Otherwise you will run into the crash you are reporting.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.