iOS

1. SDKのインストール

1. <PROJECT-NAME>.xcworkspaceファイルを開きます。

2. iosフォルダの下にframeworksというフォルダを作成します。

3. 下記のリンクから希望するバージョンのフレームワークをインストールしてXcode上に、frameworksフォルダにフレームワークファイルを移しながらCopy Items If neededをチェックします。

4. プロジェクト設定でFrameworks、Libraries、and Embedded ContentにおいてフレームワークをすべてEmbed & Signに設定します。

2. SDKの設定

1. AppDelegate.mファイルから以下の2つをインポートします。

AppDelegate.m
#import <IMQAMPMAgent/IMQAMPMAgent.h>
#import <IMQACrashAgent/IMQACrash.h>

2. AppDelegate.mファイルで- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions関数の一番上に下記のコードを追加します。

AppDelegate.m
NSString* PROJECT_KEY = @"<PROJECT_KEY>";

IMQACrashConfiguration* crashConfig = [[IMQACrashConfiguration alloc] initWithApiKey:PROJECT_KEY];
[IMQACrash startWithConfiguration:crashConfig];

IMQAConfig* mpmConfig = [[IMQAConfig alloc] init:PROJECT_KEY];
[[IMQAMpm sharedInstance] runWithConfig:mpmConfig];

3. ビルドの後に実行した時、下記のようなログが確認されたら正常にインストールが完了します。

3. Cordovaの設定

1. HTMLの最上段にWebview Agentをインストールします。(インストールした後、ビルドは必須)

2. XcodeにおいてCordovaLib/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.mファイルを探します。

3. CDVWebViewEngine.mの上にMPM SDKをインポートします。

4. - (void)pluginInitialize関数においてWKUserContentControllerを変更する部分を探して変更します。

5. - (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message関数を探して変更します。

***必ずその関数の一番上に追加してください。***

Last updated