[Bug]: Dynamically resolve target name in cap run ios

オープン
#8,024 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
ios, typescript
領域
cli, mobile

調査の方向性

cli/src/ios/run.ts のリンクされたバンドルパスのロジックから始め、次に xcodebuild -scheme -showBuildSettings が TARGET_NAME をどのように公開するかを確認します。リンクされた再現プロジェクトを使って、scheme 名と target 名が異なる場合に deployment が target の .app パスを解決することを検証します。

索引モデルが issue の本文から書いたものです。

説明

triage
Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Installed Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Other API Details
not relevant
Platforms Affected
  • iOS
  • Android
  • Web
Current Behavior

When running a Capacitor iOS application which has multiple schemes with cap run ios --scheme Dev --configuration Dev the deployment fails with

Deploying Dev.app to 00008101-001525992141001E - failed!
[error] ERR_UNKNOWN: Path
        '<project_dir>/ios/DerivedData/<id>/Build/Products/Dev-iphoneos/Dev.app'
        not found

as the runIOS function assumes that the .app name matches the scheme name (i.e., ${runScheme}.app). See: ios/run.ts#L59

However, by default this is not always correct, as the .app name is determined by the target name, not the scheme name. This can cause deployment to fail because the .app bundle is not found at the expected path, when the scheme and target names differ.

Expected Behavior

The Capacitor CLI should dynamically query the actual TARGET_NAME associated with the selected scheme using xcodebuild -showBuildSettings, ensuring the correct .app name is used during deployment. This would make runIOS more robust and compatible with a broader range of Xcode project configurations.

Project Reproduction

IsAvaible/cap-run-dynamic-target-name-reproduction

Additional Information

This can be fixed by adding a helper function that invokes:

xcodebuild -scheme <scheme> -showBuildSettings

...and extracts the TARGET_NAME from the output. This resolved name should then be used in place of ${runScheme} when determining the final app bundle path.

This enhancement would:

  • Improve compatibility with multi-target/-scheme projects
  • Prevent .app not found errors
  • Align behavior with actual Xcode project structure

Let me know if you'd like a PR for this :).

主要言語
TypeScript
スター
17.1k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/capacitor のほかの issue

ionic-team/capacitor の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。