Repository navigation
fix(macos): 修复 macOS 14 首次启动引导窗口布局循环导致闪退 (#54) - #70
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在 macOS 14.8.7 上,0.1.15 一启动就退出,退出码 133。系统日志显示 AppKit 抛出了异常:
根因
#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 失败。Fixes #54
🤖 Generated with Claude Code