1. Home
  2. Developer Guides
  3. [NEW!] iOS SDK 6.0 - Native
  4. Testing your ApptentiveKit Integration

Testing your ApptentiveKit Integration

This document will help you verify that Events and Interactions have been properly configured within your app.

Dedicated Test App Key/App Signature

We recommend using dedicated test credentials when exploring Apptentive features.

Create a new app on your Apptentive dashboard, then find its API key in your app settings. Set the test API key in your iOS project:

Apptentive.shared.register(with: .init(key: "<#Test App Key#>, signature: "<#Test App Signature#>"))

Using the test credentials will allow you to modify Apptentive settings without fear of annoying the users of your live app.

Testing the Rating Dialog

Set Criteria and Limits

When your app is live and in the hands of customers, you won’t want to annoy them with a Rating Dialog the first time they open the app. Your settings should prevent the Rating Dialog from being shown too early or if the person has not frequently used your app.

These safe Rating Dialogs work well in the App Store, but they’re very hard to test. You don’t want to wait 3 days to see your prompt.

Instead, on your Test account, select criteria that are easier to trigger.

Setting “app launches” to 1 will ensure that the Rating Dialog is shown the first time its event is engaged.

Target the Rating Dialog to an Event

Engage a new event in your application, test_event:

Apptentive.shared.engage(event: @"test_event" from: viewController)

Run your app, then engage the event by calling the above method. The best way to accomplish this is to hook the method up to a button in your app that you can easily press at will.

Once a single instance of your event has been recorded, you can target a Rating Dialog to that event. Select the Rating Dialog from your dashboard’s Interaction’s tab. In the “Who & When” section, you can now select test_event from the event target menu.

Trigger the Rating Dialog

Start by reseting your iOS simulator and/or deleting the app from your device. This ensures that only new data is used.

Be sure to set Apptentive’s APIKey to the Test app API key you set up previously.

Run the app, and wait approximately 30 seconds for your Apptentive settings to be downloaded.

Now, engage your test event:

Apptentive.shared.engage(event: @"test_event" from: viewController)

You should see the Love Dialog pop up. “Do you love <Name of your App>?”

Testing Surveys

Surveys are easier to test, as they do not have the same complicated logic as the Rating Dialog.

Create a new survey via your Apptentive dashboard. When creating the survey you will be prompted to target the survey to a particular event. As with the Rating Dialog, you will engage this same event in your app to trigger the survey:

Apptentive.shared.engage(event: @"survey_test_event" from: viewController)

Delete the app from your device or simulator to force a refresh of the interaction and targeting data. When you run the app again, the new survey you created will be downloaded to your device.

Engaging the target event should then display the survey.

Updated on March 10, 2022

Was this article helpful?

Related Articles