1. Home
  2. Developer Guides
  3. iOS - Native
  4. Testing Your Apptentive Integration: iOS

Testing Your Apptentive Integration: iOS

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

Dedicated Test API key

We recommend using a dedicated test API key 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 sharedConnection].APIKey = @"<#your Apptentive API key#>";

Using the test API key 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 sharedConnection] engage:@"test_event" fromViewController: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 sharedConnection] engage:@"test_event" fromViewController:viewController];

You should see the Rating Dialog pop up. “Do you love app_name?”

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 sharedConnection] engage:@"completed_in_app_purchase" fromViewController:viewController];

Reset your iOS simulator and delete the app from your device to force a refresh of the Apptentive cache. 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 August 19, 2020

Was this article helpful?

Related Articles