# Crash 설치

IMQA Crash를 iOS 프로젝트에 추가하면, Objective-C 및 Swift 로 개발한 앱에서 발생하는 어플리케이션의 성능 문제를 다양한 시각으로 확인할 수 있습니다.&#x20;

최신 업데이트 가이드는 <https://github.com/onycom-imqa/IMQA-Crash-Release> 에 업데이트 됩니다.&#x20;

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

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

## &#x20;<a href="#framework" id="framework"></a>

## 1. 프레임워크 설치 <a href="#framework" id="framework"></a>

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

### **XCFrameworks** <a href="#xcframework" id="xcframework"></a>

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

2\. 압축을 푼 후에 IMQACrash.xcframework 파일을 드래그하 Targets > \[Project Name] > General > Frameworks, Libraries, and Embedded Content로 옮겨주세요.

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

### **CocoaPods 방식** <a href="#cocoapods" id="cocoapods"></a>

1\. 프로젝트 Podfile에 다음과 같이 작성합니다. (반드시 source 부분에 추가 해주세요.)

```
pod 'IMQACrashAgent', '~> 3.27.0'
```

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

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

## 2. Objective-C 환경 초기화 코드 <a href="#objective-c" id="objective-c"></a>

### AppDelegate.m Header 설정 <a href="#appdelegate-m" id="appdelegate-m"></a>

프로젝트 AppDelegate.m에서 IMQACrash 헤더를 추가 해줍니다.

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

```swift
#import <IMQACrashAgent/IMQACrash.h>
```

{% endcode %}

### **AppDelegate.m 실행 코드 설정** <a href="#appdelegate-m-code" id="appdelegate-m-code"></a>

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

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

```swift
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  NSString* PROJECT_KEY = @"<PROJECT_KEY>";
  IMQACrashConfiguration* crashConfig = [[IMQACrashConfiguration alloc] initWithApiKey:PROJECT_KEY];
  [IMQACrash startWithConfiguration:crashConfig];

  return YES;
}
```

{% endcode %}

## 3. Swift 환경 초기화 코드 <a href="#swift" id="swift"></a>

### \<project\_name>-bridging-header.h  <a href="#project-name" id="project-name"></a>

프로젝트에서 IMQACrash 브릿지 헤더를 추가 해줍니다.

{% code title="\<project\_name>-bridging-header.h" %}

```
#import <IMQACrashAgent/IMQACrash.h>
```

{% endcode %}

### AppDelegate.swift 실행 코드 설정 <a href="#appdelegate-swift-code" id="appdelegate-swift-code"></a>

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

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

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

    let PROJECT_KEY = ""
    let crashConfig = IMQACrashConfiguration(PROJECT_KEY)
    IMQACrash.start(with: crashConfig)

    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/crash-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.
