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
相关产品推荐
相关产品推荐

