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

Abierto
#8,024 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
ios, typescript
Área
cli, mobile

Línea de trabajo

Comienza en cli/src/ios/run.ts, en la lógica vinculada a la ruta del bundle, y después inspecciona cómo xcodebuild -scheme -showBuildSettings expone TARGET_NAME. Usa el proyecto de reproducción vinculado para verificar que el despliegue resuelve la ruta .app del target cuando los nombres del scheme y del target difieren.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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 :).

Lenguaje dominante
TypeScript
Estrellas
17.1k
Forks
1.3k
Merge medio
1 d 22 h
PR fusionados (30 d)
26

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ionic-team/capacitor

Todos los issues de ionic-team/capacitor

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.