# Add live chat to an iOS app: Frosvo SDK guide

Source: https://frosvo.com/docs/add-chat-to-ios-app
Updated: 2026-10-25

Add the Frosvo chat SDK to an iOS app with Swift Package Manager. Configure it with your website key, present the chat from a Help button, and send replies as push notifications.

When a customer is stuck inside your app, the quickest help is a chat behind a Help button. The Frosvo SDK for iOS presents a full-screen chat, shows an unread badge, and sends replies to the phone as push notifications. Conversations arrive in the same shared inbox as your website chats.

## What do I need before I start?

- An iOS app targeting iOS 14 or later.
- A Frosvo account with the website that stands for your app added under **Settings → Websites**, and its **website key** copied.
- For push notifications: an Apple Push key, or a Firebase project if your app uses Firebase Cloud Messaging.

## How do I add the SDK?

1. Download the iOS SDK from **Settings → Mobile apps**, or from [`/downloads/frosvo-ios.zip`](/downloads/frosvo-ios.zip), and unzip it.
2. In Xcode choose **File → Add Package Dependencies… → Add Local…** and pick the unzipped folder. You can also push it to your own Git host and add it by URL.
3. Add the `FrosvoChat` library to your app target.

## How do I show the chat?

```swift
import FrosvoChat

// Once, e.g. in application(_:didFinishLaunchingWithOptions:)
Frosvo.configure(websiteKey: "your-website-key")

// When someone signs in to your app (optional)
Frosvo.setUser(name: "Pat Lee", email: "pat@example.com", hash: hashFromYourServer)

// From a "Help" button
Frosvo.present(from: self)

// Unread badge for your Help button
Frosvo.onUnread = { count in helpButton.badge = count }

// When someone signs out
Frosvo.reset()
```

The hash is optional and proves who the user is. See [show signed-in customers by name](/docs/identify-signed-in-customers) for how your server makes it. To use another Frosvo server, pass `baseURL` to `configure`.

## How do I add push notifications?

1. In Frosvo, open **Settings → Mobile apps**, choose the website and add your Apple Push key (.p8 with its Key ID, Team ID and bundle ID), or a Firebase service account if your app uses Firebase.
2. Pass the device token to the SDK:

   ```swift
   func application(_ app: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken token: Data) {
       Frosvo.setDeviceToken(token)          // APNs
   }
   // or, with Firebase: Frosvo.setFCMToken(fcmToken)
   ```

3. Open the chat when a Frosvo notification is tapped:

   ```swift
   func userNotificationCenter(_ c: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler done: @escaping () -> Void) {
       Frosvo.handleNotification(response.notification.request.content.userInfo, from: rootViewController)
       done()
   }
   ```

Replies are pushed only when the person has not already read them on screen. Each notification carries `frosvo: "1"`, `conversation_id` and `site_key`.

## How do I test it?

1. Run the app, tap your Help button and send a message.
2. Open the Frosvo desk: the message is in the shared inbox, labelled with your website.
3. Reply from the desk. With the app in the background, a push notification should reach the phone; tap it and the conversation opens.
4. Sign out of your app, call `Frosvo.reset()`, sign in as someone else and check they start a fresh conversation.

## What if it does not work?

- **The chat opens blank.** Check the website key and the phone's internet connection.
- **No push notification arrives.** Check the Apple Push key (or Firebase account) is saved for this website, the bundle ID matches your app, and the token reached the SDK.
- **The wrong person's history shows.** Call `Frosvo.reset()` when someone signs out.

For the overview of all four SDKs and push, see [chat in your mobile apps](/docs/mobile-apps). If you build your own screens, the [developer hub](/developers) has the REST API and real-time events. For other problems, try [troubleshooting](/docs/troubleshooting). The same chat is available for [Android](/docs/add-chat-to-android-app), [React Native](/docs/add-chat-to-react-native-app) and [Flutter](/docs/add-chat-to-flutter-app).

## Common questions

### Which iOS versions does the SDK support?

iOS 14 and later. It is a Swift Package with no dependencies, added with Swift Package Manager.

### Can I use Apple push notifications instead of Firebase?

Yes. Add your Apple Push key (.p8, Key ID, Team ID and bundle ID) in Settings, Mobile apps, and pass the device token to the SDK. If your app uses Firebase, a Firebase service account works too.

### Do I have to build the chat screen myself?

No. The SDK presents a full-screen chat, the same chat your website visitors use. You add a Help button and call one function.

### What happens when a user signs out of my app?

Call Frosvo.reset(). An open chat starts over, and the next person gets a fresh conversation instead of the previous person's history.
