# iOS (external)

The **DatagramConferenceFramework** is an iOS SDK that allows you to integrate conference functionality into your app. It supports retrieving conference information and joining conferences using either a URL or an alias, with built-in GUI support.

## Installation Guide

**Step 1:** Navigate to the[ Datagram Conference SDK GitHub repository](https://github.com/Datagram-Group/datagram_conference_framework_ios) and download the entire repository.

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FtvsGpA2pxIlyKV44dwjT%2Fimage6.png?alt=media&#x26;token=2a02d218-adbe-49ef-bf54-849d487ad622" alt=""><figcaption></figcaption></figure>

**Step 2:** Inside the downloaded files, open the **`lib`** folder. Copy the file `DatagramConferenceFramework.framework` into your Xcode project directory.

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FKRE2mBk2dKBrSjuVJeN2%2Fimage3.png?alt=media&#x26;token=18f9fcec-5b9a-4f62-8818-4d4abc7ad1c7" alt=""><figcaption></figcaption></figure>

**Step 3:** Open your project in **Xcode**.

**Step 4: I**n **Build Settings**, search for `Framework Search Paths` and add the path to the folder where the framework is located.

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FwxsKiceVoeDPzIYXn0VV%2Fimage5.png?alt=media&#x26;token=c66e52a6-f6bd-4cff-b8f8-f3e8b489c787" alt=""><figcaption></figcaption></figure>

**Step 5:** Go to the **General** tab of your project settings. Under **Frameworks, Libraries, and Embedded Content**, change the embed option for the framework to **"Embed & Sign".**

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FfSobEcxHwCuD0jGCJNgv%2Fimage4.png?alt=media&#x26;token=d3c791ce-a174-4dc1-a9d1-c68223ce74b6" alt=""><figcaption></figcaption></figure>

**Step 6:** Open your app's `Info.plist`file and add **camera** and **microphone** usage descriptions. These are required—if they’re missing, your app will crash when accessing **audio/video**.

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FCuN4jRUaAeREkUhNcyYt%2Fimage2.png?alt=media&#x26;token=ab70f0b2-84cb-4949-b9e0-e84c98a95db4" alt=""><figcaption></figcaption></figure>

**Step 7:** To allow conference calls to continue while the app is in the background, enable background modes:

* Go to the **Signing & Capabilities** tab.
* Add **Background Modes**.
* Enable the **Voice over IP** option.

<figure><img src="https://4099249966-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2JG2WtN9P3Hm437FJZ3R%2Fuploads%2FQnjMAu9SLB125U3i2f3C%2Fimage1.png?alt=media&#x26;token=671c7122-e612-4475-baf7-4392cc561e41" alt=""><figcaption></figcaption></figure>

## Usage

### Import the Framework

Add this line at the top of your Swift file:

```
import DatagramConferenceFramework
```

### Load Conference Info

Use the following method to fetch conference details using a URL or an alias:

#### Objective-C Signature:

```
+ (void)getConferenceInfo:(NSString *_Nullable)url
                    Alias:(NSString *_Nullable)alias
              completion:(void(^)(NSDictionary<NSString *,id> * _Nullable result))resultBlock;

```

**What It Does:**

* Retrieves details about a conference using either its **URL** or **alias**.
* If valid, the result will contain
  * **name**: name of the conference
  * **alias**: same as input
  * **expiredAt**: timestamp when the conference expires
* If there's an error, the **error** key will indicate either **"InvalidUrl"** or **"NotFound."**

#### Swift Example:

```
ConferenceSDK.getConferenceInfo(nil, alias: alias) { [weak self] result in
    guard let self = self else { return }

    if let validResult = result {
        NSLog("validResult = %@", validResult)

        if let aliasText = alias, text.count > aliasText.count, qrcodeDict.count < 3 {
            self.joinLinkTextField.text = alias
            self.joinLinkPrefixLabel.text = JoinLinkPrefixText
            self.layoutPrefixView()
        }

        if let resultAlias = validResult["alias"] as? String, !resultAlias.isEmpty {
            self.showAliasDetail(info: validResult)
        } else {
            let notFoundError = "Event not found. Please try again"
            self.showLinkError(errorString: notFoundError)
        }
    }
}
```

### Join Conference (with built-in GUI)

Use this method to join a conference via alias or URL:

#### Objective-C Signature:

```
+ (void)joinConference:(NSString *_Nullable)url
                Alias:(NSString *_Nullable)alias
                  Name:(NSString *_Nullable)name
            completion:(void(^)(NSDictionary<NSString *,id> * _Nullable result))resultBlock;
```

What It Does:

* Joins a conference using the given **URL** or **alias**.
* On success, no result is returned.
* On failure, **the result** will contain an **"error"** key with either **"InvalidUrl"** or **"NotFound."**

#### Swift Example:

```
if resultAlias != nil {
    ConferenceSDK.joinConference(nil, alias: resultAlias, name: "SDK-Demo") { joinResult in
        // Handle result if needed
    }
}
```
