iOS SDK

Use RudderStack’s iOS SDK to send events from your iOS apps to various destinations.

The RudderStack iOS SDK lets you track your customer event data from your iOS applications and send it to your specified destinations via RudderStack.

Refer to the GitHub codebase to get a more hands-on understanding of the SDK.

warning
This documentation is written for the iOS SDK v1.
info

You can integrate the iOS SDK with your tvOS and watchOS apps and seamlessly track user events without any additional configuration.

The SDK supports tvOS tracking in version 1.1.0 and above. watchOS tracking is supported in version 1.3.1 and above.

success

A new version of RudderStack iOS SDK is now available. Some key features of this release include:

  • Support for tracking events from your macOS apps
  • Support for tracking push notifications

SDK setup requirements

To set up the RudderStack iOS SDK, the following prerequisites must be met:

  • You need to set up a RudderStack account.

  • Once signed up, set up an iOS source in the dashboard. You should be able to see a Write Key for this source, as shown below:

    iOS source write key

  • You also need a data plane URL. Refer to the Glossary for more information on the data plane URL and where to find it.

success
The Setup tab in the RudderStack dashboard (seen above) has an SDK installation snippet containing both the write key and the data plane URL. You can use it to integrate the iOS SDK into your project.
  • Finally, you need a Mac with the latest version of Xcode.

Installing the RudderStack iOS SDK

You can install the iOS SDK through Cocoapods and Carthage. The recommended and easiest way to add the SDK to your project is through Podfile. To do so, follow these steps:

warning
Remember to include the following code in all .m and .h files or your .swift files where you want to refer to or use RudderStack SDK classes.
danger
RudderStack uses SQLite to store events locally before sending them to the RudderStack data plane. Making calls like SQLite.shutdown() which is not thread-safe might lead to unexpected crash.

Swift Package Manager

You can also install the iOS SDK through Swift Package Manager (SPM) via one of the following methods:

Initializing the SDK

Put this code in your AppDelegate.m file under the method didFinishLaunchingWithOptions:

RudderStack automatically tracks the following application lifecycle events:

You can disable these events using the withTrackLifecycleEvents method of RSConfigBuilder and passing false. However, it is highly recommended to keep them enabled.

RudderStack supports all major API calls across all iOS devices via the SDK. These include the track, identify, and screen calls.

The iOS SDK integrates with the OneTrust consent manager and lets you specify the user’s consent during initialization. For more information, refer to the OneTrust Consent Management for iOS guide.

Configuring the RudderStack client

You can configure your client based on the following parameters using RSConfigBuilder:

ParameterTypeDescriptionDefault Value
logLevelintControls how much of the log you want to see from the SDK.RSLogLevelNone
dataPlaneUrlstringYour Data Plane URL.https://hosted.rudderlabs.com
flushQueueSizeintNumber of events in a batch request sent to the server.30
dbThresholdCountintNumber of events to be saved in the SQLite database. Once the limit is reached, older events are deleted from the DB.10000
sleepTimeoutintMinimum waiting time to flush the events to the server.10 seconds
configRefreshIntervalintFetches the config from dashboard after the specified time.2 hours
trackLifecycleEventsbooleanSpecify whether the SDK will capture application life cycle events automatically.true
collectDeviceIdbooleanDetermines if the SDK should automatically collect the device ID. If set to NO, it does not send context.device.id as a part of the event payload. See Disabling device ID collection for more information.true
autoSessionTrackingbooleanDetermines if the SDK automatically tracks the user sessions. Refer to Tracking user sessions for more information.true
sessionTimeoutintMaximum inactivity period before the session expires.300000 ms (5 minutes)
recordScreenViewsbooleanSpecify whether the SDK will capture screen view events automatically. Refer to Automatically capturing screen views for more details.false
enableBackgroundModebooleanSpecify whether the SDK should send the events for some time when the app is moved to the background. Currently it is available only for iOS & tvOS.false
gzipbooleanGzips the event requests.true
dbEncryptionobjectSpecify whether to encrypt/decrypt the database using your desired key. See Encrypting RudderStack databases for more information.-
controlPlaneUrlstringThis parameter should be changed only if you are self-hosting the control plane. See our control plane lite documentation on GitHub for details. The iOS SDK will add /sourceConfig along with this URL to fetch the required configuration.https://api.rudderlabs.com

Self-hosted control plane

If you are using a device mode destination like Adjust, Firebase, etc., the iOS SDK needs to fetch the required configuration from the control plane. If you are using the Control plane lite utility to host your own control plane, then follow the steps in this section and specify controlPlaneUrl in RSConfigBuilder that points to your hosted source configuration file.

warning
Do not pass the controlPlaneUrl parameter during SDK initialization if you are using RudderStack Cloud. This parameter is supported only if you are using our open-source Control plane lite utility to self-host your control plane.

Gzipping requests

success
The Gzip feature is enabled by default in the iOS SDK.

The iOS SDK automatically gzips event requests. To disable this feature, set the Gzip parameter to NO while initializing the SDK:

warning
Gzip requires rudder-server v1.4 or higher. Otherwise, your events might fail.

Identify

The identify call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc. Once you identify the user, the SDK persists all the user information and passes it on to the subsequent track or screen calls. To reset the user identification, you can use the reset method.

warning

Note that:

  • For older SDK versions (< v1.19.0), the iOS SDK captures the device ID and uses that as anonymousId for identifying the user. This helps the SDK to track the users across the application installation.
  • According to the Apple documentation, if the device has multiple apps from the same vendors, all those apps will be assigned the same device ID. If all applications from a vendor are uninstalled, then on next install the app will be assigned a new device ID.
  • Starting from v1.19.0, the SDK uses a UUID as anonymousId instead of the device ID. If you are upgrading from a previous SDK version, see How RudderStack sets anonymous ID for more information on how the SDK collects and sets anonymousId.

An example identify event is as shown:

The identify method accepts the following parameters:

NameData TypeRequiredDescription
userIdNSStringYesDeveloper identity for the user.
traitsNSDictionaryNoTraits information for user. Use dict method of RudderTraits to convert to NSDictionary easily
optionsRudderOptionNoExtra options for the identify event.

Setting custom anonymous ID

RudderStack use the deviceId as anonymousId by default. You can use the following method to override and use your own anonymousId with the SDK.

An example of setting the anonymousId is shown below:

To retrieve anonymousId, use the anonymousId instance property:

[RSClient getInstance].anonymousId;

Disabling device ID collection

Starting from v1.19.0, you can disable the collection of device ID by setting the withCollectDeviceId API of the RSConfigBuilder class to NO.

You will observe the following changes when this API is set to false:

  • The SDK does not send context.device.id as a part of the event payload.
  • The SDK replaces the existing anonymousId (if it is equal to the device ID) with a UUID.
info
These changes are introduced to make the SDK more compliant with all policies around the device ID collection.
warning

If you are upgrading to the latest SDK from a previous version (< v1.19.0) and disabling device ID collection using withCollectDeviceId:NO:

  • Make sure your user transformations are not dependent on context.device.id as the SDK will not send this value in the event payload.
  • The context.device.id column in your warehouse destination will not be populated henceforth (it will still contain data populated by the previous SDK version).

How SDK sets anonymous ID

For direct/fresh SDK installation

For a fresh installation of the iOS SDK v1.19.0 and later, RudderStack uses UUID as anonymousId regardless of whether withCollectDeviceId is set to YES or NO.

For updating SDK from older version

If you are updating your iOS SDK from an older version (< v1.19.0), then:

  • RudderStack will continue to use the device ID as anonymousId - it will not break the existing SDK behavior until you set withCollectDeviceId to NO.
  • If you set withCollectDeviceId to NO, the SDK checks if the existing anonymousId is a device ID. If yes, it sets a new UUID as the anonymousId.
  • If you have used the putAnonymousId method to set your own anonymousId, then the SDK will not modify it even if you set withCollectDeviceId to NO.

Setting a custom ID

You can pass a custom ID along with the standard userId in your identify calls. RudderStack adds this value under context.externalId.

warning
RudderStack supports passing externalId only in the identify events. You must not pass this ID in other API calls like track, page, etc.

The following snippet shows how to add an externalId to your identify event:

Track

You can record the users’ activity through the track method. Every user action is called as an event.

A sample track event is as shown:

The track method accepts the following parameters:

NameData TypeRequiredDescription
eventNameNSStringYesName of the event you want to track
propertiesNSDictionaryNoExtra data properties you want to send along with the event
optionsRudderOptionNoExtra event options

Screen

You can use the screen call to record whenever the user sees a screen on the mobile device. You can also send some extra properties along with this event.

An example of the screen event is as shown:

The screen method accepts the following parameters:

NameData TypeRequiredDescription
screenNameNSStringYesName of the screen viewed by the user.
propertiesNSDictionaryNoExtra property object that you want to pass along with the screen call.
optionsRudderOptionNoExtra options to be passed along with the screen event.

Automatically capturing screen views

To automatically capture the screen views, you can enable the recordScreenViews parameter while initializing the SDK:

Note that if automatic screen recording is enabled, RudderStack removes every instance of ViewController in the screen event.

For example, if automatic screen recording is enabled and you set the ViewController class name to HomeViewController, then the SDK sets the screen event name to Home.

For more details related to this implementation, refer to the iOS SDK repository.

Group

The group call associates a user to a specific organization. A sample group call for the API is below:

Alternatively, you can use the following method signature

NameData TypeRequiredDescription
groupIdStringYesAn ID of the organization with which you want to associate your user
traitsNSDictionaryNoAny other property of the organization you want to pass along with the call
optionsRudderOptionNoEvent level options
info
RudderStack does not persist the traits for the group across the sessions.

Alias

The alias call associates the user with a new identification. A sample alias call for the API is below:

natively, you can use the following method signature

NameData TypeRequiredDescription
newIdStringYesThe new userId you want to assign to the user
optionsRudderOptionNoEvent level option

RudderStack replaces the old userId with the newUserId and we persist that identification across the sessions.

Reset

You can use the reset method to clear the persisted user traits. It also resets the anonymousId with a new UUID if you call it with YES (for SDK v1.19.0 and later). To clear only user traits, call reset with NO.

In session tracking, calling the reset method clears the current sessionId and generates a new one.

A sample reset call is shown:

Encrypting RudderStack databases

info
This feature is available from iOS SDK v1.20.0.

The iOS SDK uses a SQLite database to store events before sending them to the RudderStack backend (data plane).

By default, SQLite databases created by RudderStack are not encrypted but they are still protected by iOS - similar to data in any iOS application. To add an extra level of security, you can use the SQLCipher extension to encrypt the database content and SQLite metadata.

Using CocoaPods

info
This feature is supported for SQLCipher v4.0 and above.

Step 1: Integrate SDK with SQLCipher

  1. RudderDatabaseEncryption is available through CocoaPods. To install it, add the following line to your Podfile:
pod 'RudderDatabaseEncryption', '~> 1.0.0'
  1. Run the pod install command.

Step 2: Import the iOS SDK

Step 3: Initialize the SDK

Place the following snippet in your app’s AppDelegate under didFinishLaunchingWithOptions method:

Using Swift Package Manager (SPM)

Registering an RSDatabaseProvider implementation

The standard SQLite library does not support encryption out of the box. Hence, you need to integrate a third-party option into your codebase. RSDatabaseProvider acts as a bridge between this third-party code and RudderStack, and uses SQLCipher for the implementation.

info
To integrate SQLCipher with your application, see the instructions for the community or commercial editions.

Once SQLCipher is correctly set up, add the below implementation of the RSDatabaseProvider protocol in your project.

warning
Copy-paste the code exactly as given below and change the class names as per your requirement.
  1. Register your database provider with the RudderStack iOS SDK. The following setup code is recommended:

The iOS SDK is now configured to support database encryption.

warning

After you encrypt the database:

  • If no key is provided, then the SDK deletes the current database with unsent events and creates a new unencrypted database instead.
  • If a wrong key is provided, then the SDK deletes the current database with unsent events and creates a new encrypted database with the given key.

The SDK does not store the key, so it cannot determine whether the entered key is right or wrong. Hence, if the key cannot decrypt the database, the SDK assumes it to be incorrect and deletes the old events and database.

Instructions for linking issues

The Cocoapod RudderDatabaseEncryption uses the SQLCipher Cocoapod under the hood to perform encryption. This Cocoapod requires the removal of any references to the standard SQLite system library for it to function as expected.

If you set up a project to inadvertently include a linking reference against the standard SQLite library before SQLCipher, it is possible that the application builds and runs correctly but does not use SQLCipher for encryption. This is not a problem for most projects but there are certain cases where unintentional SQLite linking can occur.

One such example is when using CocoaPods or some other sub-project that declares a dependency on the SQLite3 library. In this case, adding a pod to a project can silently modify the project settings in such a way that SQLCipher is not properly linked.

You can identify and fix the above linking issue during the development stage by looking for the below error log from the SDK:

RSDBPersistentManager: createDB: Cannot encrypt the Database as SQLCipher wasn't linked correctly.

To fix the linking issue, add a linker flag to your project settings to ensure that the Xcode links SQLCipher before SQLite. Follow these steps:

  1. Open the project-level build settings. These are the global project settings, not for the individual application target.
  2. Locate the Other Linker Flags setting and add one of the following commands depending on how you are integrating SQLCipher into the app.
warning
If you are not adding SQLCipher into the app on your own and only using RudderDatabaseEncryption, then see only the points 3 and 4 in the below table - depending on whether you are using use_frameworks! in your app’s ios/Podfile.
ScenarioCommandNotes
When using SQLCipher commercial edition static libraries$(PROJECT_DIR)/sqlcipher-static-ios/ios-libs/libsqlcipher-ios.aAdjust according to the path to the libsqlcipher-ios.a you received as a part of the package.
When using the sqlcipher.xcodeproj included in the SQLCipher Git repository$(BUILT_PRODUCTS_DIR)/libsqlcipher.a-
When using the SQLCipher CocoaPod with the use_frameworks Podfile setting enabled-framework SQLCipher-
When using the SQLCipher CocoaPod without the use_frameworks Podfile setting enabled-lSQLCipher-

Once the linker flag is added to the project-level build settings, you should see something like the below image:

Project-level build settings

After adding the linker flag to your project-level build settings, check the target-level build settings to ensure SQLCipher is shown first, as seen below:

Target-level build settings

Enabling/disabling user tracking via the optOut API (GDPR)

RudderStack gives users (e.g., an EU user) the ability to opt out of tracking any user activity until the user gives their consent. You can do this by leveraging RudderStack’s optOut API.

The optOut API takes YES or NO as a Boolean value to enable or disable tracking user activities. This flag persists across device reboots.

The following snippet highlights the use of the optOut API to disable user tracking:

the user grants their consent, you can enable user tracking once again by using the optOut API with NO or false as a parameter sent to it:

The optOut API is available in the RudderStack iOS SDK starting from version 1.0.24.

Setting custom context

You can use the putCustomContext method on a instance of RSOption to set custom contextual information as a nested object within context while sending the events.

An example of setting custom context using an instance of RSOption and passing it in a track call:

The context object in the created event payload looks like below:

{
  "context": {
    "tier": {
      "category": "premium",
      "type": "gold",
    }
  }
}
warning

Note that:

  • The iOS SDK does not support setting custom contextual information during initialization.
  • The SDK does not persist the contextual information set using putCustomContext for subsequent events. Hence, you must use this method every time you want to set custom context for an event.

Setting the device token

You can pass your device-token for Push Notifications to be passed to the destinations which support Push Notification. We set the token under context.device.token.

Follow the instructions below:

We have kept IDFA collection completely separate from the Core library so that the developer has better control over the same. You can pass the IDFA to putAdvertisementId method to set it under context.device.advertisingId

Follow the instructions below:

You can pass the ATTrackingManager.trackingAuthorizationStatus to RudderStack. RudderStack then sends it to the relevant destinations as required. For example, AppsFlyer accepts this parameter for the attribution to work in their server-to-server mode.

You can pass the following options to the putAppTrackingConsent method:

  • RSATTNotDetermined
  • RSATTRestricted
  • RSATTDenied
  • RSATTAuthorize

Filtering events

When sending events to a destination via device mode, you can explicitly specify which events should be discarded or allowed to flow through - by allowlisting or denylisting them.

Refer to the Client-side Event Filtering guide for more information on this feature.

Enabling/disabling events for specific destinations

The RudderStack iOS SDK allows you to enable or disable event flow to a specific destination or all destinations to which the source is connected. You can specify these destinations by creating a RSOption object as shown:

The keyword All in the above snippet represents all destinations the source is connected to. Its value is set to true by default.

info
Make sure the destination display name you pass while specifying the custom destinations should exactly match the destination name as shown here.

You can pass the destination(s) specified in the above snippet to the SDK in two ways:

1. Passing destinations while initializing the SDK

This is helpful when you want to enable/disable sending the events across all event calls made using the SDK to the specified destinations.

2. Passing destinations while making event calls

This approach is helpful when you want to enable/disable sending only a particular event to the specified destination(s) or if you want to override the specified destinations passed with the SDK initialization for a particular event.

If you specify the destinations both while initializing the SDK as well as making an event call, then the destinations specified at the event level only will be considered.

Tracking user sessions

info
The iOS SDK supports session tracking starting v1.7.0.

By default, the iOS SDK automatically tracks the user sessions. This means that RudderStack automatically determines the start and end of a user session depending on the inactivity time configured in the SDK (default time is 5 minutes).

warning
To automatically track sessions in the iOS SDK, withTrackLifecycleEvents should also be set to true. This is because RudderStack considers the Application Opened, Application Installed, or Application Updated events as the start of a new session.

To disable automatic session tracking, set withAutoSessionTracking to false.

info
For more information on the user sessions and how to track them using the iOS SDK, refer to the Session Tracking guide.

Adding callback support for mobile device mode integrations

info

Note the following:

  • This feature is supported in the iOS SDK v1.24.0 and above.
  • Currently, the callback support is only available for the Braze mobile device mode integration. It will be implemented for other integrations over time.

The iOS SDK supports a onIntegrationReady callback functionality that returns the instance of the mobile device mode integration after the destination SDK is initialized.

You can use this feature to obtain the Braze SDK instance and use it for registering to Braze’s in-app messaging feature.

Sending granular device model information

Starting from iOS SDK v1.25.0, you can send the context.device.model in a more detailed format to your downstream destinations. The SDK sends the device model information in the standard Apple format like iPhone 13,1 instead of the earlier format iPhone. Here, iPhone 13,1 corresponds to the human-readable format iPhone 12 Mini.

While most destinations are able to recognize the standard Apple format, there might some cases where the destination is unable to comprehend it. For such cases, you can use the Localize Apple Device Model transformation to convert the standard Apple device model into a human-readable format.

Apple device model enrichment

The transformation code is as follows:

import { getLocalizedDeviceModel } from "@rs/localizeAppleDeviceModel/v1";

 export function transformEvent(event, metadata) {
 const localizedDeviceModel = getLocalizedDeviceModel(event);
  if(localizedDeviceModel && event?.context?.device?.model) {
    event.context.device.model = localizedDeviceModel;
  }
  return event;
}

See the Localize Apple Device Model transformation template for more information.

Developing a device mode destination

You can easily develop a device mode destination if RudderStack doesn’t support it already. Follow these steps:

  1. Create a CustomIntegration class by extending RSIntegration.
  1. Create a CustomFactory class by extending RSIntegrationFactory:
  1. Register CustomFactory with the iOS SDK during its initialization:

Some pointers to keep in mind:

  • RudderStack’s iOS SDK dumps every event it receives to the dump() method of the CustomFIntegration class. From here, you can process the event and hand it over to the native SDK of the device mode destination.
  • The SDK also triggers the reset() method of the CustomFactory class on every reset() call made via the SDK. You can use this to handle the destination-specific reset logic.
  • Make sure you do not duplicate the value of KEY present inside CustomFactory, across multiple CustomFactory that you develop.

Flushing events using flush API

The iOS SDK supports the flush() API. RudderStack retrieves all messages present in the database, divides them into individual batches based on the specified queue size, and flushes them to the RudderStack server/backend.

For example, if the flushQueueSize is 30 and there are 180 events in the database when the flush() API is called, the SDK will retrieve all those events and divide them into batches of 30 messages each, that is, into 6 batches.

If a batch fails for some reason, RudderStack drops the remaining batches to maintain the sequence of the messages. A batch is considered as failed if it isn’t sent to the RudderStack server after 3 retries.

In device mode, the flush() API also calls the destination SDK’s flush() API (if applicable).

For every flush() call made via the iOS SDK, the flush() method of the CustomFactory class is also triggered, which can be used to handle the destination-specific reset logic. You can make a flush call using the SDK as shown:

Debugging

If you run into any issues regarding the RudderStack iOS SDK, you can turn on the VERBOSE or DEBUG logging to find out what the issue is. To turn on the logging, change your RudderClient initialization to the following:

Chromecast integration

Google Chromecast is a device that plugs into your TV or monitor with an HDMI port, and can be used to stream content from your phone or computer.

RudderStack supports integrating the iOS SDK with your Cast app. Follow these instructions to build your iOS sender app. Then, add the iOS SDK to it. Follow the Google Cast developer guide for more details.

Privacy manifest

Your apps and third-party SDKs (usually distributed as Swift packages, XCFrameworks, or framework bundles) contain a privacy manifest file named PrivacyInfo.xcprivacy. It records the data collected by your app/third-party SDK and the associated required reason API.

You need to record the reasons in your privacy manifest for each data type your app/SDK collects along with the category of required reasons API that it uses.

See the Apple developer documentation for more information on creating a privacy manifest.

info

Starting Spring 2024, you are required to include an approved reason in your app’s privacy manifest that accurately reflects how your app uses the API.

This is a mandatory requirement to upload a new app/app update to the App Store Connect. For more information, see this Apple update.

Privacy Accessed API Types

NSPrivacyAccessedAPITypes is an array of dictionaries describing the API types your app/third-party SDK accesses that have been designated as APIs that require reasons to access.

The RudderStack iOS SDK only uses the userDefaults API to store user and context information and it is declared in the privacy manifest in the iOS SDK repository.

Privacy tracking domains

NSPrivacyTrackingDomains is an array of strings listing the internet domains that your app/third-party SDK connects to for tracking purposes. If the user has not granted the tracking permissions through the App Tracking Transparency framework, the network requests to these domains fail and you get an error on your app.

The privacy manifest for the RudderStack iOS SDK includes the domain rudderstack.com to which all RudderStack events are sent.

Privacy Nutrition Label Types

NSPrivacyCollectedDataTypes is an array of dictionaries that describe the data types your app/third-party SDK collects.

The RudderStack iOS SDK includes an array of Privacy Nutrition Label Types for the following automatically-collected fields:

DataLinked to userUsed for trackingCollection purpose
App versionNoNo
  • Developer advertising or marketing
  • Analytics
App nameNoNo
  • Developer advertising or marketing
  • Analytics
Crash dataNoNoApp functionality
Device IDNoNo
  • Developer advertising or marketing
  • Analytics
  • Third-party advertising
Product interactionNoNoApp functionality
Other data typesNoNoApp functionality

See Apple’ developer documentation for more information on the above collection purposes.

FAQ

I’m facing issues building with Carthage on XCode 12. What should I do?

If you’re facing an issue with Carthage and XCode 12, you can follow this workaround suggested by the Carthage team.

Does the SDK support tvOS ?

As of version 1.1.0, the iOS SDK supports the tvOS platform.

Does the SDK support watchOS ?

As of version 1.3.0, the iOS SDK supports the watchOS platform.

How do I migrate from v1.0.2?

Update the usage of the following classes as per the table below:

Previous NameUpdated Name
RudderClientRSClient
RudderConfigRSConfig
RudderConfigBuilderRSConfigBuilder
RudderLogLevelDebugRSLogLevelDebug
Other LogLevels follow the same nomenclature.

How do I ensure the events tracked just before closing/backgrounding the app are sent immediately and not on the next app launch?

To ensure that the events tracked just before closing/backgrounding the app are sent to RudderStack immediately, you can set withEnableBackgroundMode to YES while creating the RSConfigBuilder object as shown below:

info
Currently, this feature is available only for iOS & tvOS platforms.

By doing so, your app requests iOS for some additional background run time to run the app, which in turn allows the SDK to immediately send the events tracked just before the app is closed/backgrounded, instead of waiting till the next app launch.

This SDK feature relies on the background mode capability offered by the iOS. There is no set number on the background run time the apps get, as it is completely abstracted by iOS. For more information, refer to this guide.

How can I get the user traits after making the identify call?

You can get the user traits after making an identify call in the following way:

How does the SDK handle different client/server errors?

In case of client-side errors, e.g. if the source write key passed to the SDK is incorrect, RudderStack gives you a 400 Bad Request response and aborts the operation immediately. For other types of network errors (e.g. Invalid Data Plane URL), the SDK tries to flush the events to RudderStack in an incremental manner (every 1 second, 2 seconds, 3 seconds, and so on).

Why is there a larger difference between timestamp and received_at for iOS events vs. Android events?

This scenario is most likely caused by the default behavior of iOS apps staying open in the background for a shorter period of time after a user closes them.

When a user closes an iOS or Android app, events will still continue to be sent from the queue until the app closes in the background as well. Any events still in the queue will remain there until the user reopens the app. Due to this lag, there are some scenarios where there can be significant differences between timestamp (when the event was created) and received_at (when RudderStack actually receives the events).

For Android apps, events can be sent from the background after apps close for a longer period of time than iOS apps, therefore, more of the events coming from the Android SDK have closer timestamp and received_at times.

Does RudderStack integrate with SKAdNetwork?

RudderStack does not integrate with SKAdNetwork. However, SKAdNetwork can be directly integrated into an iOS application alongside RudderStack.

Yes, you can.

RudderStack gives you the ability to disable tracking any user activity until the user gives their consent, by leveraging the optOut API. This is required in cases where your app is audience-dependent (e.g. minors) or where you’re using the app to track the user events (e.g. EU users) to meet the data protection and privacy regulations.

The optOut API takes true / false (in case of Swift) or YES / NO (in case of Objective-C) as a value to enable or disable tracking user activities. So, to disable user tracking, you can use the optOut API as shown:

the user gives their consent, you can enable user tracking again:

For more information on the optOut API, refer to the Enabling/Disabling User Tracking via optOut API (GDPR Support) section.

success
You only need to call the optOut API with the required parameter only once, as the information persists within the device even if you reboot it.

Can I apply encryption only on new databases?

Database encryption works on new or existing databases. You can pass the RSDBEncryption object in RSConfigBuilder while initializing the iOS SDK.

See Configuring the RudderStack client for more information on the configuration options.

Can I remove encryption from an encrypted database?

Yes, you can. When passing the RSDBEncryption object, configure the object with the encryption key and set enable to false. It will remove the encryption from the encrypted database.

See Creating an encryption object for more information.

How does the iOS SDK handle events larger than 32KB?

The iOS SDK drops any events greater than 32KB.


Questions? Contact us by email or on Slack