You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WatchOS中使用Digital Crown操作SwiftUI Picker时触发ScrollView错误的问题求助

WatchOS中使用Digital Crown操作SwiftUI Picker时触发ScrollView错误的问题求助

大家好,我遇到了一个WatchOS SwiftUI的问题,想请各位帮忙排查一下。

我写了一个非常简短的WatchOS App示例,但在用Digital Crown操作Picker滚动选择时,它并没有按照预期工作,反而触发了错误。以下是完整代码:

import SwiftUI

struct ContentView: View {

    let array = ["One","Two","Three","Four"]

    @State var selection = "One"

    var body: some View {

        Picker("Array", selection: $selection) {
            ForEach(array, id: \.self) {
                Text($0)
            }
        }
    }
}

使用Digital Crown滚动时,会抛出以下两个错误:

  • ScrollView contentOffset binding has been read; this will cause grossly inefficient view performance as the ScrollView's content will be updated whenever its contentOffset changes. Read the contentOffset binding in a view that is not parented between the creator of the binding and the ScrollView to avoid this.
  • Error: Error Domain=NSOSStatusErrorDomain Code=-536870187 "(null)"

我已经在真实设备(Apple Watch 8,45mm,watchOS 10.3)和Xcode 15.2上测试过,但问题依然存在。

非常感谢大家的帮助!

备注:内容来源于stack exchange,提问作者Duckjd

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 10:40:27