Skip to content

fix(macos): 修复 macOS 14 首次启动引导窗口布局循环导致闪退 (#54) - #70

Merged
Hiwoniu merged 1 commit into
mainfrom
fix/onboarding-layout-loop
Nov 22, 2026
Merged

Hiwoniu merged 1 commit into
mainfrom
fix/onboarding-layout-loop

Conversation

@Hiwoniu

@Hiwoniu Hiwoniu commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

问题

在 macOS 14.8.7 上,0.1.15 一启动就退出,退出码 133。系统日志显示 AppKit 抛出了异常:

The window has been marked as needing another Update Constraints in Window pass,
but it has already had more Update Constraints in Window passes than there are views in the window.

根因

#11 为了修复 macOS 15 上「继续」按钮被裁切,让引导窗口跟随内容的首选高度(sizingOptions = [.preferredContentSize])。但引导页的左右两栏都用了 .frame(maxHeight: .infinity),内容会撑满窗口给它的高度,于是首选高度又反过来等于窗口高度。窗口和内容互相跟随,macOS 14 上会一直循环,直到 AppKit 抛出异常、App 退出。

新增的测试 testTheOldFrameFollowedTheOfferedHeight 证实了这一点:旧写法下,提议的高度不同,内容报告的高度也不同。

改动

  • 新增 OnboardingFrame 布局:不管窗口给多大,都按「设计宽度 × max(600, 当前步骤的理想高度)」报告尺寸。窗口仍然随步骤的内容变高([AI] fix: 修复 macOS 15 首次引导继续按钮被裁切 #11 的修复保留),但内容不再反过来跟随窗口,结构上不会再循环。
  • OnboardingFlow.body 改成用 OnboardingFrame 包裹原来的内容,布局本身不变。
  • 新增 OnboardingFrameTests(3 个测试)。

验证

  • swift build 编译通过,swift test 共 189 个测试,0 失败。
  • 在 macOS 26.3 上实际启动开发包并强制打开引导:第一步窗口 920×887,「继续」按钮完整可见,日志里没有约束异常。
  • 没有在 macOS 14 上验证(手头没有这个系统的设备),需要在 macOS 14 上用正式签名的包确认启动不再闪退。
  • 我完成了微信流.app的安装但是现在通过启动台点击应用图标打不开应用的界面 #54 里提到的另一个问题(蓝奏云上的 b23 是开发签名包、没有公证)和这次的代码修改无关,需要重新正式打包上传。

Fixes #54

🤖 Generated with Claude Code

…54)

Since #11 the guide window follows its content's preferred size, but the
content stretches with maxHeight: .infinity and so reported back whatever
height the window offered. On macOS 14 that feedback ends in AppKit's
"more Update Constraints in Window passes than there are views"
exception, and 微信流 exits right after launch.

OnboardingFrame now sizes the guide at the design width and at
max(600, the step's own ideal height), whatever it is offered, so the
window still grows for a tall step (the macOS 15 fix stays) but the
content no longer follows the window back.

Fixes #54

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hiwoniu
Hiwoniu merged commit 3361cc3 into main Nov 22, 2026
2 checks passed
@Hiwoniu
Hiwoniu deleted the fix/onboarding-layout-loop branch November 22, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

我完成了微信流.app的安装但是现在通过启动台点击应用图标打不开应用的界面

2 participants