question

grabdeveloper avatar image
grabdeveloper asked

Insights SDK iOS: failure to submit events and failure to fetch variations

Hi, I am integrating the insights SDK into our iOS app, and I'm running into issues. I have set up a new identifier, and followed the steps. I boiled down the code into just this: id options = [AIAmazonInsights optionsWithAllowEventCollection:YES withAllowWANDelivery:YES]; id credentials = [AIAmazonInsights credentialsWithApplicationKey: @"MY_PUBLIC KEY" withPrivateKey: @"MY PRIVATE KEY"]; AIAmazonInsights* insights = [AIAmazonInsights insightsWithCredentials: credentials withOptions: options]; id eventClient = insights.eventClient; id level1Event = [eventClient createEventWithEventType:@"level4start"]; [eventClient recordEvent:level1Event]; after this runs, and after the app is suspended, the SDK gives the error of failed submission of events. I'm not sure how to debug this further. Perhaps I also need to include some frameworks in the project that are not specified in the documentation? Am I missing some set up steps on the dashboard side of things? Here is some addition information: 1.) I have attempted to also set up an A/B test. When I run the code to ask for a variation, the SDK spits out an unable to get variations error with a 403. 2.) If I attempt to put an incorrect public key when I initialize the SDK, the entire app crashes when this runs. 3.) I attempted this both over wifi and over LTE, with the same results 4.) I attempted to go to this link: https://applab-sdk.amazon.com/1.0/applications/MY_PUBLIC_KEY from multiple browsers and devices, and I always get a page saying "We're sorry. The Web address you entered is not a functioning page on our site. Please double-check the URL for typos and other errors..." Any help in this issue would be greatly appreciated. Thank you,
10 |5000

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

grabdeveloper avatar image
grabdeveloper answered
I also forgot to mention that the SystemConfiguration and CoreTelephony frameworks, and libz.dylib library, are added to the project, as per the documentation. The issue still exists
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Grabdeveloper, Verify that the public and private keys you generated through the Analytics web portal were copied correctly into the parameters of the AIInsightsCredentials object. Try to access https://applab-sdk.amazon.com/1.0/applications/MY_PUBLIC_KEY/events from the device you are using to test integration to verify you can communicate with the service. You should see "The signature was not present on the request" if you can successfully communicate with our service from that device. What incorrect public key did you attempt to put into the Credentials object? Was it a NULL key or NSString of some arbitrary length? Can you provide any information around the crash? You no longer need to include the CoreTelephony framework to use the AmazonInsights SDK. We will update our documentation to reflect this.
10 |5000

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