# Event Stream Mobile Quickstart


This quickstart guide will help you get started with using [RudderStack mobile SDKs]({{< ref "sources/event-streams/sdks/_index.md#mobile" >}}) to stream events from your mobile app to other tools in your stack.

Note that all the examples and code snippets in this guide are for the iOS (Objective-C) SDK.

## Overview

For simple use cases, you can get data flowing from your mobile app to other tools in your stack in less than 15 minutes by following these steps:

1. **Install a RudderStack SDK** in your mobile app.
2. **Instrument API calls** to identify users and capture user actions (like page views and button clicks).
3. **Connect destination integrations** to stream events to business tools and your warehouse automatically.

{{< tip >}}
[Sign up](https://app.rudderstack.com/signup) for a free RudderStack account before you get started.
{{< /tip >}}

## Step 1: Install the iOS (Obj-C) SDK

In most cases, installing one of RudderStack's [mobile SDKs]({{< ref "sources/event-streams/sdks/_index.md#mobile" >}}) takes a developer less than 10 minutes.

### How data engineers can get the iOS (Obj-C) SDK code

1. Sign in to your RudderStack account and click **+ Add source** in the default **Connections** view.

{{< image src="images/get-started/quickstart/add-source.webp" alt="Add source" >}}

2. Select **iOS (Obj-C)** from the list of sources.
3. Copy the installation snippet under the **Setup** tab (this snippet contains the {{< glossary_tooltip "write-key" >}} and {{< glossary_tooltip "data-plane-url" >}}, which ensure events are sent to the correct source).

{{< image src="images/get-started/quickstart/ios-snippet.webp" alt="iOS SDK snippet" >}}

4. Send the snippet to your mobile development team.

### How mobile developers can install the iOS (Obj-C) SDK

{{< info >}}
Before installing the iOS (Obj-C) SDK, make sure to first initialize the `Podfile` within your app by running `pod init`.

If you are using Swift Package Manager (SPM) to install the iOS (Obj-C) SDK, see these [instructions]({{< ref "sources/event-streams/sdks/rudderstack-ios-sdk/_index.md#swift-package-manager" >}}).
{{< /info >}}

1. Install the iOS (Obj-C) SDK using [Cocoapods](https://cocoapods.org/pods/Rudder) by adding the iOS (Obj-C) SDK to your application's `Podfile`: 

```ruby
pod 'Rudder'
```

2. Run the following command to install the SDK and the required dependencies:

```bash
pod install
```

{{< warning >}}
Include the following code in all `.m` and `.h` files where you want to reference or use the RudderStack SDK classes.

```objectivec
#import <Rudder/Rudder.h>
```
{{< /warning >}}

#### **Initialize the SDK**

Your data engineer should have provided you the [iOS (Obj-C) SDK snippet](#how-data-engineers-can-get-the-ios-sdk-code). Follow these steps to initialize the SDK:

1. Open your app's `AppDelegate.m` file - the entry point of the app.
2. Place the initialization snippet under the `didFinishLaunchingWithOptions` method.

{{< info >}}
You can choose to place the snippet under any method in any other file based on your requirement.
{{< /info >}}

A sample initialization snippet is shown below:

{{< tabs tabTotal="2" >}}
{{% tab tabName="Objective-C" %}}
```objectivec
RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];
[builder withDataPlaneUrl:DATA_PLANE_URL];
[RSClient getInstance:WRITE_KEY config:[builder build]];
```
{{% /tab %}}
{{% tab tabName="Swift" %}}
```swift
let builder: RSConfigBuilder = RSConfigBuilder()
    .withDataPlaneUrl(DATA_PLANE_URL)
RSClient.getInstance(WRITE_KEY, config: builder.build())
```
{{% /tab %}}
{{< /tabs >}}

For more information, see the full [iOS (Obj-C) SDK documentation]({{< ref "sources/event-streams/sdks/rudderstack-ios-sdk/_index.md" >}}). 

{{< success >}}
See this [sample iOS app](https://github.com/rudderlabs/rudder-sdk-ios/blob/develop/Examples/RudderSampleAppObjC/RudderSampleAppObjC/_AppDelegate.m) for more information on initializing the SDK.
{{< /success >}}

## Step 2: Instrument API calls

All RudderStack mobile SDKs follow a [standard event spec]({{< ref "event-spec/standard-events/_index.md" >}}). It helps you plan your event data and supports various API calls for tracking your mobile app events - these include `identify`, `track`, `screen`,  `group`, `alias`, and `reset` calls.

In addition, the mobile SDKs track the following [application lifecycle events]({{< ref "event-spec/standard-events/application-lifecycle-events-spec.md" >}}) automatically:

- [`Application Installed`]({{< ref "event-spec/standard-events/application-lifecycle-events-spec.md#application-installed" >}})
- [`Application Updated`]({{< ref "event-spec/standard-events/application-lifecycle-events-spec.md#application-updated" >}})
- [`Application Opened`]({{< ref "event-spec/standard-events/application-lifecycle-events-spec.md#application-opened" >}})
- [`Application Backgrounded`]({{< ref "event-spec/standard-events/application-lifecycle-events-spec.md#application-backgrounded" >}})

Most users start by implementing `track` and `identify` calls.

You can use **`track` calls** to record user activities like adding a product to a cart or wishlist, tapping a button on the app, selecting an option, etc. You can describe the `track` events with {{< glossary_tooltip "properties" >}}.

Here is an example of a `track` call named `Product Added`. The properties are `price` and `quantity`:

```objectivec
[[RSClient sharedInstance] track:@"Product Added" properties:@{
    @"price" : @"23.99",
    @"quantity" : @"2"
}];
```

**`identify` calls** are typically fired when a user performs an identifying action like creating an account or making a purchase. `identify` calls also associate a known user with their actions (even if previously anonymous). You can describe users with attributes by adding {{< glossary_tooltip "traits" >}} to the payload. 

Here is an example of an `identify` call. The `traits` are `firstName`, `lastName`, `email`, and `country`:

```objectivec
[[RSClient sharedInstance] identify:@"user_id"
traits:@{@"firstName": @"Alex",
        @"lastName": @"Keener",
        @"email": @"alex@example.com",
        @"country" : @"US",
}
];
```

See the [RudderStack iOS (Obj-C) SDK]({{< ref "sources/event-streams/sdks/rudderstack-ios-sdk/_index.md" >}}) documentation for more information on the other supported API calls.

## Step 3: Verify data flow and connect destination integrations

Once software engineers have installed the SDK and instrumented events, the data team can verify the event flow into RudderStack. Then, they can connect destination integrations to forward events to the tools in their stack automatically.

### 1. Verify data flow for your iOS (Obj-C) source

Before connecting destinations, verify that events are flowing into RudderStack by checking the **Live Events** viewer in your iOS (Obj-C) source.

To see live events, go to your iOS (Obj-C) source from the **Connections** view and click the **Live Events** button in the top right of your screen. 

{{< info >}}
There will be a delay before you see events in the **Live Events** view. RudderStack doesn't store any data; it temporarily opens a gateway between the control plane and data plane to show you the live events. The delays usually last only a few seconds but on the [RudderStack Free](https://rudderstack.com/pricing/) plan, they can last up to one minute.
{{< /info >}}

{{< image src="images/get-started/quickstart/source-live-events-ios.webp" alt="Live Events" >}}

After a few seconds, you will see events populating the feed. 

{{< warning >}}
If you do not see events in the **Live Events** view, then there is likely a problem with your instrumentation.
{{< /warning >}}

### 2. Connect destination integrations

{{< success >}}
RudderStack supports 200+ integrations including data warehouses and data lakes, marketing platforms, CRMs, analytics tools, streaming platforms, and more. You can see the full list of supported destination integrations [here]({{< ref "destinations/overview.md" >}}).
{{< /success >}}

To add a destination in RudderStack:

1. Click **+ Add destination** in the default **Connections** view.

{{< image src="images/get-started/quickstart/add-destination.webp" alt="Add destination" >}}

2. From the list, select your preferred destination where you want to route the event data. Here are some popular destinations to help you get started:

| Category | Destination |
| :----| :------|
| Analytics | [Amplitude]({{< ref "destinations/streaming-destinations/amplitude/" >}}), [Mixpanel]({{< ref "destinations/streaming-destinations/mixpanel/" >}}), [GA4]({{< ref "destinations/streaming-destinations/google-analytics-4/_index.md" >}}) |
| CRM | [HubSpot]({{< ref "destinations/streaming-destinations/hubspot/_index.md" >}}), [Salesforce]({{< ref "destinations/streaming-destinations/salesforce/" >}}) |
| Marketing | [Braze]({{< ref "destinations/streaming-destinations/braze/_index.md" >}}), [Mailchimp]({{< ref "destinations/streaming-destinations/mailchimp.md" >}}) |
| Object storage | [Amazon S3]({{< ref "destinations/streaming-destinations/amazon-s3.md" >}}), [Redis]({{< ref "destinations/streaming-destinations/redis.md" >}}) |
| Streaming platforms | [Apache Kafka]({{< ref "destinations/streaming-destinations/kafka.md" >}}), [Amazon Kinesis]({{< ref "destinations/streaming-destinations/amazon-kinesis.md" >}}) | 
| Warehouses | [Snowflake]({{< ref "destinations/warehouse-destinations/snowflake.md" >}}), [BigQuery]({{< ref "destinations/warehouse-destinations/bigquery.md" >}}), [Redshift]({{< ref "destinations/warehouse-destinations/redshift.md" >}}) | 
| Data lakes & lakehouses | [Databricks]({{< ref "destinations/warehouse-destinations/delta-lake/_index.md" >}}), [Google Cloud Storage]({{< ref "destinations/warehouse-destinations/gcs-datalake.md" >}}) | 

3. Set up the destination by configuring the connection settings. For details, see the destination-specific documentation.

## Next steps

This section contains some optional, but helpful steps that leverage RudderStack's most popular features for transforming events and debugging problems.

### Add event transformations

One of RudderStack's most-loved features is [Event Transformations]({{< ref "transformations/overview.md" >}}), which you can use to operate on the payloads flowing through RudderStack. You can use it for:

- Sampling or filtering events.
- Removing sensitive user PII from your events.
- Enriching events using static logic, an external API, and more.

To use a transformation:

1. In the left sidebar, go to **Collect** > **Transformations**. Then, click **Create Transformation**.

{{< image src="images/get-started/quickstart/create-transformation.webp" alt="Create transformation" >}}

2. Select a [transformation template]({{< ref "transformations/templates.md" >}}) from the list depending on your use case. To create a transformation from scratch, click **Custom transformation**.

{{< success >}}
Transformation templates contain prepopulated, ready-to-use transformation logic, which you can apply to your events before sending them to the destination. You can also modify the code as per your needs.
{{< /success >}}

{{< image src="images/features/transformation-templates-2.webp" alt="Choose a template" >}}

3. Verify if your transformation works as expected by clicking the **Run Test** button.

{{< image src="images/features/run-test-transformations.webp" alt="Testing a transformation" >}}

4. Click **Save** to save your transformation.
5. Go to the **Connections** tab of your transformation and connect it to the destination you set up above. See [Connect transformation to destination]({{< ref "transformations/manage.md#connect-transformation-to-destination" >}}) for more information.

{{< info >}}
When you add a transformation and connect it to a destination, RudderStack does the following:

1. Tracks events at the source.
2. Applies the transformation logic to your events.
3. Converts the events in a format the destination expects - RudderStack does this internally and requires no user intervention.
4. Sends the transformed events to your destination.
{{< /info >}}

### Debugging

RudderStack gives you complete observability into your events and the ability to debug errors that might occur in case of event failures. It provides the [Live Events]({{< ref "monitor/live-events.md" >}}) feature, where you can:

- Verify your instrumentation.
- Get a real-time view of the events flowing from your sources to the connected destinations.
- Identify and debug any errors at the source, destination, or transformation level and narrow down the root cause of the issue.

#### **Source Live Events viewer**

This is helpful to verify if RudderStack is receiving the source events at all. The payload you see in this viewer is the raw event payload collected from your website.

{{< image src="images/get-started/quickstart/source-live-events-ios.webp" alt="Live Events" >}}
{{< image src="images/rs-cloud/source-live-events-details.webp" alt="Source live events details" >}}

#### **Transformation Live Events viewer**

This viewer will give you a before and after snapshot of the event going into your user transformation and what it looks like afterward. It also notifies you about any dropped events or errors during the transformation, along with the details.

{{< image src="images/rs-cloud/transformation-live-events.webp" alt="Transformation live events" >}}

{{< image src="images/rs-cloud/transformation-live-events-errors.webp" alt="Transformation live events error message" >}}

#### **Destination Live Events viewer**

This viewer shows you what the payload looks like when RudderStack sends it to the destination. You can also see the detailed error message if the destination returns an error.

{{< image src="images/rs-cloud/destination-live-events-details.webp" alt="Payload to the destination" >}}

See the [Live Events]({{< ref "monitor/live-events.md" >}}) documentation for more details.

## Support

For any questions on using RudderStack, you can:
- Start a conversation in our [Community Slack](https://rudderstack.com/join-rudderstack-slack-community).
- Drop an email to [RudderStack support](mailto:support@rudderstack.com).

