前回は、比較的多いCordovaプラグインに関連するAndroidでのビルドエラーについて説明しました。今回は、iOS編になります。

エラー1

[!] CocoaPods could not find compatible versions for pod "FirebaseInAppMessaging":
  In Podfile:
    FirebaseInAppMessaging (= 12.3.0-beta)
Specs satisfying the FirebaseInAppMessaging (= 12.3.0-beta) dependency were found, but they required a higher minimum deployment target.

このエラーは、Monacaプロジェクトに設定されているminimum deployment targetのバージョンが、Cordovaプラグインに設定されているCocoaPodsのライブラリーが要求するバージョンより低い場合に出力されます。

Monacaプロジェクトのminimum deployment targetの設定は、config.xmlに以下のdeployment-target設定を追加することで対応することができます。valueの値は、CocoaPodsのライブラリーが要求するバージョン以降を指定します。

<platform name="ios">
  <preference name="deployment-target" value="15.0"/>
</platform>

エラー2

/tmp/download/platforms/ios/日本語名/Plugins/admob-plus-cordova/AMBAdBase.swift:1:8: error: no such module 'GoogleMobileAds'
import GoogleMobileAds
/tmp/download/platforms/ios/XXX日本語名/Plugins/cordova-plugin-firebasex/FirebasePlugin.m:8:9: fatal error: module 'FirebaseAnalytics' not found
@import FirebaseAnalytics;
 ~~~~~~~^~~~~~~~~~~~~~~~~
ld: framework not found Pods_______
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Failed to install 'cordova-plugin-firebasex': Error: pod: Command failed with exit code 1 Error output:
[!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

このエラーは、Monacaプロジェクトのアプリケーション名に日本語等の2バイト文字や記号が含まれている場合に出力されます。Monacaプロジェクトのアプリケーション名は、
ビルドの際にファイル名ディレクトリ名に使用されます。

CocoaPodsでは、ファイル名やディレクトリ名の日本語等の2バイト文字や記号を正しく処理することができないため、上記のようなエラーが発生します。

対応方法については、config.xmlのnameディテクティブにCordovaが提供しているshort属性を設定することで対応できます。short属性を設定することで、
モバイル端末にアプリをインストールした際のアプリケーション名を設定することができます。

<name short="日本語名">appName</name>

エラー3

clang: error: unsupported option '-G' for target 'arm64-apple-ios11.0'
clang: error: unsupported option '-G' for target 'arm64-apple-ios12.2'
clang: error: unsupported option '-G' for target 'arm64-apple-ios15.0'
error: unsupported option '-G' for target 'arm64-apple-ios12.0' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios13.0' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios17.0' (in target 'BoringSSL-GRPC' from project 'Pods')

このエラーは、Cordovaプラグインが、ビルドを実行しているiOSプラットフォームやXcode環境に対応していない場合に出力されます。上記のエラーが出力された場合は、以下のMonacaクラウドIDEのメニューからiOSプラットフォームとXcodeの最新版を選択してビルドを試してみてください。

  • ビルド - ビルド環境の設定 - IOS - プラットフォーム - iOS 7.1.1
  • ビルド - ビルド環境の設定 - IOS - Xcode - Xcode 26.0.1

エラー4(Android共通)

Failed to restore plugin "cordova-plugin-customurlscheme". You might need to try adding it again. Error: CordovaError: Variable(s) missing (use: --variable URL_SCHEME=value).

このエラーは、MonacaプロジェクトにCordovaプラグインが要求しているVariable設定が行われていない場合に出力されます。MonacaでCordovaプラグインのVariable設定を行う場合は、MonacaクラウドIDEのメニュー、

設定 - Cordovaプラグインの管理 - 有効なプラグイン

に表示されている対象のCordovaプラグインの設定画面を開き、インストールパラメータ項目に対象設定を入力することで対応できます。


おわりに

今回は、Cordovaプラグインに関連するiOSのビルドエラーについて説明しました。iOSの場合は、CocoaPods関連のビルドエラーが多くみられます。iOSビルドエラーの解決の参考にしてください。