# Crash SDKインストール

IMQA Crashを iOSプロジェクトに追加すると、Objective-CとSwiftで開発したアプリで発生するアプリケーションの性能問題を様々な視点から確認することができます。\
最新アップデートガイドは、<https://github.com/onycom-imqa/IMQA-Crash-Release>にアップデートされます。

{% 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. SDK Embedded Framework方式 <a href="#framework" id="framework"></a>

IMQA Crash SDKは、2種類のSDKインストール方法をご提供しています。ご利用中の環境に適したインストール方法を選択して実行してください。

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

1\. 以下のリンクから、最新SDKファイルをダウンロードしてください。

\[<https://github.com/onycom-imqa/IMQA-Crash-Release/releases/download/v3.9.0/IMQACrashAgent.zip>]

2\. 圧縮を解除したらIMQACrashAgent.frameworkファイルをTargets > \[Project Name] > General > Frameworks, Libraries と Embedded Contentへ移してください。

3\. SDKインストールが完了しました。

### **CocoaPods**方式 <a href="#cocoapods" id="cocoapods"></a>

1\. プロジェクトPodfileに以下のとおり入力してください。(必ずsource部分に追加してください。)

```
pod 'IMQACrashAgent', '~> 3.24.1'
```

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 でIMQACrashAgentヘッダを追加してください。

{% 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:に IMQACrashAgentを初期化してください。PROJECT\_KEY は、IMQAサイトでプロジェクトを作成すると発行を受けることができます。

{% 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:に IMQMCrashAgentを初期化してください。PROJECT\_KEYは、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/jpn/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.
