--- title: Objective-C Setup Guide tags: - Setup - iOS - macOS - watchOS - tvOS - ObjectiveC featured: false testedOn: Xcode 14.1 & Swift 5.5 description: Configure the TelemetryDeck SDK in Your Objective-C Application for iOS and macOS lead: Let's include the TelemetryClient Swift Package in your Objective-C application and send events! order: 1000 --- Lots of iOS and macOS application are still written in Objective-C, or a mixture of Swift and ObjC. We've got you covered either way, and this guide will show you how to set up the TelemetryDeck SDK in your Objective-C application. ## Installing the package The TelemetryDeck Swift package uses Swift Package Manager. 1. Open Xcode and navigate to the project you want to add TelemetryDeck to. 1. In the menu, select File -> Add Packages.... This will open the Swift Package Manager view. 1. Paste `https://github.com/TelemetryDeck/SwiftSDK` into the search field. 1. Select the `SwiftSDK` package that appears in the list 1. Set the Dependency Rule to Up to Next Major Version. 1. Click Add Package.  This will include the TelemetryDeck Swift Client into your app by downloading the source code. Feel free to browse the client's source code. It's tiny and you'll see for yourself how TelemetryDeck is hashing user identifiers before they ever reach the server. Privacy, yay! ## Including the package in your target Xcode will ask you to link the package with your target in the next screen, titles Choose Package Products for SwiftSDK. Select the `TelemetryClient` library and click Add Package. {% noteinfo "Link Library with more than one Target" %} In case Xcode forgets to ask you to link the library with your target, you can do so manually by selecting your target in the project navigator. Selecting the Build Phases tab. Click the + button in the Link Binary With Libraries section and select the `TelemetryClient` library. {% endnoteinfo %} ## Initializing the TelemetryDeck package The `TelemetryClient` package will provide you with a class `TelemetryManager` that you'll use for all interactions with TelemetryDeck. Before you can use that class, you'll need to initialize it at the start of your app. The ideal place for this is your **App Delegate**'s `application:didFinishLaunchingWithOptions:` method: ```objc // Import the TelemetryClient library @import TelemetryClient; // ... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Your other initialization code here ... // Initialize the TelemetryDeck client TelemetryManagerConfiguration *telemetryConfig = [[TelemetryManagerConfiguration alloc] initWithAppID:@"YOUR-APP-ID"]; [TelemetryManager initializeWith:telemetryConfig]; // Optional: Set a default user ID. If you don't do this, // the SDK will generate a random user ID for you. // [TelemetryManager updateDefaultUserTo:@"myuserwhojustloggedin@example.com"]; return YES; } ``` {% noteinfo "You need your app's Unique Identifier" %} TelemetryDeck assigns a unique identifier to your app, and you need to hand that identifier to the TelemetryDeck SDK. Use the [TelemetryDeck Dashboard](https://dashboard.telemetrydeck.com) to create a new app and copy its unique identifier into your computer's clipboard. {% endnoteinfo %} ## Verify your setup Run your app to verify that TelemetryDeck is properly integrated. Let's send an event to show the app has launched correctly: ```objc [TelemetryManager send:@"applicationDidFinishLaunching"]; ``` {% notewarning "When running from Xcode, you're sending test signals" %} If your app is built in `DEBUG` configuration (i.e. running from Xcode), your events will be tagged as **Test Signals**, meaning that you can easily filter them out later. You'll see them show up in the TelemetryDeck Dashboard when the **Test Mode** toggle under the tab bar is turned on. {% endnotewarning %} Open the TelemetryDeck Dashboard, navigate to "Explore > Recent Signals" and make sure "Test Mode" is enabled. You should see your signal appear after launching your app. --- {% noteinfo "Ready for basic insights" %} Congratulations! With just the SDK initialization, TelemetryDeck will automatically track user sessions, app launches, and device information. This basic setup provides valuable built-in insights without any additional code. You can now build and ship your app. Once users start using it, your TelemetryDeck dashboard will begin showing data about user behavior, device types, and other key metrics. {% endnoteinfo %} ## Enhancing your analytics (optional) While basic session tracking provides valuable information, sending custom events lets you answer questions specific to how users engage with *your* app. ### Sending custom events {% noteinfo "What's a signal?" %} Signals represent an **event** or a **view** that happened in your app, which is used by a **user**. Signals consist of these parts: - **Signal Type**: A string that indicates which kind of event happened - **Metadata Payload**: A dictionary of additional data about your app or the event triggering the signal See the [Signals Reference](/docs/api/signals-reference/) for more information about how you can effectively use Signals. {% endnoteinfo %} You don't need to keep an instance of TelemetryManager and hand it around, just call the `send` function on the class directly. If you want to add custom metadata payload, add it to the function call as a dictionary: ```objc [ TelemetryManager send:@"applicationDidFinishLaunching" with:@{@"pizzaCheeseMode": @"extraCheesy"} ]; ``` The metadata is helpful for additional parameters for filtering or grouping signals. We'll automatically add some metadata for you, like the app version, device model, and more. For more information on how to send events, see the [TelemetryDeck package's `README.md` file](https://github.com/TelemetryDeck/SwiftSDK/blob/main/README.md). ## App Store requirements Before uploading your app to the App Store, you'll need to complete Apple's privacy details on App Store Connect. Although TelemetryDeck is privacy-focused, you still need to disclose analytics usage. For guidance on completing these requirements, see our [Apple App Privacy guide](/docs/articles/apple-app-privacy/). For privacy policy recommendations, check our [Privacy FAQ](/docs/guides/privacy-faq/#do-i-need-to-add-telemetrydeck-to-my-privacy-policy%3F). ## What to do next Now that you've integrated TelemetryDeck, learn how to use the analytics platform to gain valuable insights about your users:
Learn how to navigate TelemetryDeck, interpret insights, and use analytics to make data-driven decisions that improve your app and grow your user base.
Start here to get real value from your analytics →