# MPM 설치

React Native, Cordova 환경에서 설치하시는 경우, 아래 페이지에서 설치 방법을 확인해 주세요.

* [React Native 환경에서 SDK 설치](/imqa-guide/installation/react-native/ios.md)
* [Cordova 환경에서 SDK 설치](/imqa-guide/installation/cordova/ios.md)

{% hint style="warning" %}
\[지원 OS] iOS 9.0 이상 (WebView Crash 수집의 경우 iOS 11.0 이상) / Xcode 최신 버전
{% endhint %}

{% hint style="warning" %}
IMQA 프로젝트 페이지에서 iOS 프로젝트 생성 후 <mark style="color:red;">프로젝트 키 발급 받으신 이후</mark>에 설치를 진행해주세요.
{% endhint %}

## 1. 프레임워크 설치

### **프레임워크 설치**

IMQA MPM SDK는 2가지 방식으로 SDK를 설치 방법을 제공하고 있습니다. 사용하고 계신 환경에 맞춰서 설치를 진행해 주세요.

### XCFrameworks

1\. IMQA github에서 최신 SDK 파일을 다운로드 받아주세요. \
&#x20;  \[[최신 iOS MPM SDK 다운로드하기](https://github.com/onycom-imqa/IMQA-MPM-Release/releases/download/v3.27.0/IMQAMPMAgent.zip)]

2\. 위 링크를 통해 프레임워크를 다운로드 후, Targets > \[Project Name] > General > Frameworks, Libraries, and Embedded Content로 옮겨주세요.

3\. IMQAMpmAgent의 Embed Option을 Embed & Sign으로 변경해 주세요.

4\. SDK 설치는 마무리 되었습니다.

### **CocoaPods 방식**

1\. 프로젝트 Podfile에 다음과 같이 작성합니다.&#x20;

```
use_frameworks!
pod 'IMQAMPMAgent', '3.27.0'
```

2\. 터미널에서 해당 프로젝트 위치에서 pod install을 실행해 주세요.

3\. SDK 설치는 마무리 되었습니다.

## 2. 프로젝트 설정

### **Objective-C 프로젝트 설정**

Targets > \[Project Name] > Build Settings > Build Options에서 Always Embed Swift Standard Libraries를 YES로 변경해 주세요.

## 3. Objective-C 환경 초기화 코드

### AppDelegate.m Header 설정

프로젝트 AppDelegate.m에서 IMQAMpmAgent 헤더를 추가합다.

{% code title="AppDelegate.m" %}

```
#import <IMQAMPMAgent/IMQAMPMAgent.h>
```

{% endcode %}

### AppDelegate.m 실행 코드 설정

프로젝트 AppDelegate.m에서 application: didFinishLaunchingWithOptions:에 IMQAMpmAgent를 초기화합니. 프로젝트 키는 IMQA 사이트에서 프로젝트를 생성한 후 발급 받으실 수 있습니다.

{% code title="AppDelegate.m " %}

```swift
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    NSString* PROJECT_KEY = @"<PROJECT_KEY>"; 
    IMQAConfig* mpmConfig = [[IMQAConfig alloc] init:PROJECT_KEY]; 
    [[IMQAMpm sharedInstance] runWithConfig:mpmConfig];
    
    return YES;
}
```

{% endcode %}

{% code title="AppDelegate.m " %}

```swift
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    NSString* PROJECT_KEY = @"<PROJECT_KEY>"; 
    IMQAConfig* mpmConfig = [[IMQAConfig alloc] init:PROJECT_KEY]; 
    [[IMQAMpm sharedInstance] runWithConfig:mpmConfig];
    
    return YES;
}
```

{% endcode %}

* **Objective-C 설정 방법**

{% code title="AppDelegate.m" %}

```objectivec
NSString* imqaUrl = @"https://custom-url"; 
IMQAConfig* mpmConfig = [[IMQAConfig alloc] init:PROJECT_KEY]; 
mpmConfig.api_url = imqaUrl;
```

{% endcode %}

* **Swift 설정 방법**

{% code title="AppDelegate.swift" %}

```swift
let imqaUrl = "https://custom-url" 
let mpmConfig = IMQAConfig(PROJECT_KEY) 
mpmConfig.api_url = imqaUrl
```

{% endcode %}

## 4. Swift 환경 초기화 코드

### AppDelegate.swift Header 설정

프로젝트 AppDelegate.swift에서 IMQAMpmAgent 헤더를 추가합니다.

{% code title="AppDelegate.swift" %}

```swift
import IMQAMPMAgent
```

{% endcode %}

### AppDelegate.swift 실행 코드 설정

프로젝트 AppDelegate.swift에서 application: didFinishLaunchingWithOptions:에 IMQAMpmAgent를 초기화 니다. 프로젝트 키는 IMQA 사이트에서 프로젝트를 생성한 후 발급 받으실 수 있습니다.

{% code title="AppDelegate.swift" %}

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
        
    let PROJECT_KEY = ""
    let mpmConfig = IMQAConfig(PROJECT_KEY) 
    IMQAMpm.sharedInstance.run(config: mpmConfig)
        
    return true
}
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://docs.imqa.io/imqa-guide/installation/ios/mpm-sdk-install.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
