> For the complete documentation index, see [llms.txt](https://docs.dfinery.ai/developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dfinery.ai/developer-guide/platform/ios/integration.md).

# 연동하기

## 시작하기전에

이 문서는 DFINERY iOS SDK를 iOS 앱에 통합하는 방법을 다룹니다.

더 자세히 알아보려면 [리소스 및 샘플](/developer-guide/common/resource-and-sample.md)을 참조하세요.

#### SDK 지원 환경

* iOS 12.0 +
* Xcode 16.1 +

## SDK 설치

DFINERY iOS SDK는 CocoaPods, Swift Package Manager(SPM), 수동 설치를 지원합니다.

<details>

<summary>CocoaPods</summary>

**1. CocoaPods 설치**

최신 버전의 CocoaPods을 [설치해주세요](https://guides.cocoapods.org/using/getting-started.html#installation)

**2. 의존성 추가**

Xcode 프로젝트 폴더에 `Podfile` 추가 후 Podfile에 Dfinery SDK 의존성을 추가해주세요

```
target 'YourAppTarget' do  
  pod 'DfinerySDK'
end

target 'YourServiceExtension' do  
  pod 'DfinerySDKServiceExtension'
end
```

**3. 의존성 설치**

터미널에서 다음의 명령어로 SDK를 설치해 주세요

```
pod install
```

</details>

<details>

<summary>Swift Package Manager(SPM)</summary>

**1. Xcode에서 패키지 의존성 추가**

<img src="/files/fGCzV3CkXj4UQAlShYHe" alt="" data-size="original">

**2. DFINERY SDK GitHub 저장소 입력**

<img src="/files/1PDupe8N9jB3Bob3mbcA" alt="" data-size="original">

저장소 명은 <https://github.com/IGAWorksDev/dfinery-ios-sdk> 입니다.

**3. Dependency Rule 입력 및 타겟에 DfinerySDK 추가**

<img src="/files/FBMw8Cuf9gnkGgGdOqF5" alt="" data-size="original">

**4. ServiceExtension 타겟에 DfinerySDKServiceExtension 추가**

<img src="/files/IsgFFEAOq831zuPpROV6" alt="" data-size="original">

Dfinery SDK는 [유의적 버전(Semantic versioning)2.0](https://semver.org/)을 따릅니다.

</details>

<details>

<summary>수동 설치</summary>

**1. 프레임워크 다운로드**

[여기](https://github.com/IGAWorksDev/dfinery-ios-sdk/releases/)에서 최신 프레임워크를 다운로드해 주세요

**2. 프로젝트에 프레임워크 추가**

Xcode의 Targets -> General -> Frameworks, Libraries, and Embedded Content -> + 클릭 -> Add Others... -> Add Files.. 를 통해 다운로드받은 프레임워크를 추가해 주세요

<img src="/files/DhcJAOvdtBWBWHDmnygI" alt="" data-size="original">

</details>

## SDK 초기화

#### AppDelegate 수정

{% tabs %}
{% tab title="Swift" %}
AppDelegate.Swift 파일에 다음과 같이 SDK를 import 합니다.

```swift
import DfinerySDK
```

AppDelegate 클래스에 sdk초기화 코드를 추가합니다.

```swift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        Dfinery.shared().sdkInit(serviceId: "SERVICE_ID")
        
        return true
    }
}
```

{% endtab %}

{% tab title="Objective-C" %}
AppDelegate.m 파일에 다음과 같이 SDK를 import 합니다.

```objective-c
#import <DfinerySDK/DfinerySDK.h>
```

AppDelegate 클래스에 sdk초기화 코드를 추가합니다.

```objective-c
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [[Dfinery shared] sdkInitWithServiceId:@"SERVICE_ID"];

    return YES;
}
```

{% endtab %}
{% endtabs %}

## SDK 설정

### 로그 활성화하기

디버그 로그를 보려면 `DFConfig.LOG_LEVEL`에 `DFLogLevel`을 설정합니다. 설정된 로그 레벨에 따라 로그가 debug console에 표시됩니다. Log의 Subsystem은 (BundleIdentifier).dfineryLogger 입니다.

| DFLogLevel           | 값 | 설명                                         |
| -------------------- | - | ------------------------------------------ |
| `DFLogLevel.error`   | 6 | Error 로그만 표시                               |
| `DFLogLevel.warning` | 5 | Warning, Error 로그 표시                       |
| `DFLogLevel.info`    | 4 | Info, Warning, Error 로그 표시                 |
| `DFLogLevel.debug`   | 3 | Debug, Info, Warning, Error 로그 표시          |
| `DFLogLevel.verbose` | 2 | Verbose, Debug, Info, Warning, Error 로그 표시 |

{% tabs %}
{% tab title="Swift" %}

```swift
Dfinery.shared().sdkInit(
    serviceId: "SERVICE_ID",
    config: [DFConfig.LOG_LEVEL: DFLogLevel.verbose]
)
```

{% endtab %}

{% tab title="Objective-C" %}

```objective-c
[[Dfinery shared] sdkInit:@"SERVICE_ID"
                withConfig:@{DFConfig.LOG_LEVEL: @(DFLogLevelVerbose)}]; // DFLogLevel.verbose
```

{% endtab %}
{% endtabs %}

## 완료

SDK 설치 및 초기화가 완료되었습니다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dfinery.ai/developer-guide/platform/ios/integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
