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

Đang mở
#8,024 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ios, typescript
Lĩnh vực
cli, mobile

Hướng nghiên cứu

Bắt đầu trong cli/src/ios/run.ts, tại logic liên quan đến đường dẫn bundle, sau đó kiểm tra cách xcodebuild -scheme -showBuildSettings cung cấp TARGET_NAME. Sử dụng project tái hiện được liên kết để xác minh rằng deployment phân giải đường dẫn .app của target khi tên scheme và target khác nhau.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
17.1k
Fork
1.3k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
26

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ionic-team/capacitor

Tất cả issue của ionic-team/capacitor

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.