bug(ios): 8.5 template creates the bridge view controller twice (storyboard scene key + SceneDelegate)
Maintainer thường phản hồi trong vòng 2 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
- 57/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- swift, typescript
Hướng nghiên cứu
Start with the generated iOS SPM template’s Info.plist, SceneDelegate, and Main.storyboard, then compare them with the 8.5 update guide and cap migrate behavior. Check how the scene manifest and storyboard settings interact with the SceneDelegate-created window. Done means the template and migration guidance use one consistent setup and a generated app launches with one bridge.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Capacitor Version
@capacitor/cli 8.5.3, @capacitor/ios 8.5.x (iOS SPM template)
Other API Details
Xcode 27.2, iOS 26.5 Simulator
Platforms Affected
- iOS
- Android
- Web
Current Behavior
The 8.5 iOS template (and the 8.5 update guide) configures the window in two ways at once:
Info.plistsetsUISceneStoryboardFile = Mainin the scene manifest, and still setsUIMainStoryboardFile = Main. The initial view controller ofMain.storyboardisCAPBridgeViewController.SceneDelegate.scene(_:willConnectTo:options:)creates its ownUIWindowand a newCAPBridgeViewController()in code.
Because the scene manifest names a storyboard, UIKit instantiates the storyboard's initial view controller on every launch before calling scene(_:willConnectTo:). The SceneDelegate then replaces the window, and the storyboard's controller is deallocated without loading its view.
I confirmed this by logging in a CAPBridgeViewController subclass. On each launch, both a normal launch and a background launch from a silent push, there is one init(coder:) (storyboard), one init(nibName:bundle:) (SceneDelegate), one capacitorDidLoad(), and one deinit.
In my testing the extra controller never loads a bridge, so this is redundant work, not a confirmed functional bug. I'm raising it because the setup is ambiguous: two code paths can create a CAPBridgeViewController, and the guide says Main.storyboard "no longer provides" the window or root view controller.
For context, we're investigating rare production cases on iOS where two bridges (two web app instances) appeared to run at once in a Capacitor 8.5 app, which showed up as SQLite database is locked errors. I could not tie that to this template setup, and I'm not claiming it is the cause.
Expected Behavior
The window and root view controller are created in one place. Since the SceneDelegate builds them in code, I'd propose the template drops the storyboard references:
- Remove
UISceneStoryboardFilefrom the scene configuration inInfo.plist. - Remove
UIMainStoryboardFilefromInfo.plist. It is ignored when a scene manifest is present. - Optionally remove
Main.storyboardfrom the template, and update the 8.5 guide andcap migrateto match.
The other option is to keep the storyboard and have the SceneDelegate use the window UIKit creates, without building its own. Then a custom CAPBridgeViewController subclass would be set in the storyboard, as before 8.5.
Is dropping the storyboard keys what you'd recommend for apps that have migrated? Or is there a reason the template keeps both?
Project Reproduction
Any new app from the @capacitor/cli 8.5.3 iOS SPM template (npx cap add ios). No custom code is needed except the logging below.
Additional Information
Steps to observe:
- In the generated iOS project, create
class AppViewController: CAPBridgeViewControllerthat logs ininit(coder:),init(nibName:bundle:),capacitorDidLoad()anddeinit. - Set it as the custom class of the initial view controller in
Main.storyboard, and use it inSceneDelegate(window?.rootViewController = AppViewController()), as the guide suggests for custom subclasses. - Launch the app and watch the log: there are two initializers and one
deinitper launch. - With
UISceneStoryboardFileandUIMainStoryboardFileremoved fromInfo.plist, the app still launches normally with one bridge, created by the SceneDelegate.
- Ngôn ngữ chính
- TypeScript
- Star
- 17.1k
- Fork
- 1.3k
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 32
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ionic-team/capacitor
-
[Bug]: Plugin call after navigation can be answered before reply proxy is updatedCó thể đã có người làm @MateStrysewske đã nhận 56 ngày trước. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ionic-team/capacitor#8616 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: SystemBars shrinks the WebView twice for the keyboard on Android 10 (API 29) when WebView >= 140 and viewport-fit=coverCó thể đã có người làm @theproducer đã nhận 18 ngày trước. Đang mởneeds reply
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor#8601 · 2 bình luận · 3 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ionic-team/capacitor#8574 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16)Có thể đã có người làm @kttalley đã nhận 47 ngày trước. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor#8530 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
fix(android): remove unchecked Java compilation warningsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor#8529 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của ionic-team/capacitor
Issue tương tự
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
lingdojo/kana-dojo#34223 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mastra-ai/mastra#30587 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:web p2 product:business triage:active type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
cuadrao-ai/argus#2228 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
embedpdf/embed-pdf-viewer#1098 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.Needs Triage .Team/Metabot Priority:P3 Type:Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
metabase/metabase#87252 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày