Update 2: Deleting cache only worked temporarily after removing adding devices. I'm giving up, I think we'll need to wait for Apple to solve.
Update 1: I attempted to delete any Xcode (e.g. com.apple.dt.Xcode) folders/files in the caches folder ~/Library/Caches. I can build again to my watch, for now
Same here. It briefly worked shutting down both phone and watch, removing the phone from the list of paired devices, removing my ADC account and then re-adding, booting everything up. I was able to debug on the watch, then something happened and it went back to being broken. I haven't bothered again since then.
Post
Replies
Boosts
Views
Activity
Not sure what the purpose of passing in all the items into each sub view. I’m not able to reproduce your crash in a playground, but i was getting a lot of calls to sub views when adding an item because you’re passing in the items as a binding. I removed the binding from the SubView and only passed in the number for each SubView. That stopped the Subviews from updating when adding items:
import SwiftUI
import PlaygroundSupport
import SwiftUI
struct ContentView: View {
var body: some View {
TestView(items: [1, 2, 3, 4, 5])
}
}
struct TestView: View {
@State var items: [Int]
var body: some View {
NavigationView {
VStack {
Text("Hello")
List {
ForEach(items, id: \.self) { item in
NavigationLink(destination: SubView(number: item)) {
Text("\(item)")
}
}
}
Button(action: {
self.items.append(self.items.count + 1)
}) {
Text("Add")
}
}
}
}
}
struct SubView: View {
var number: Int
var body: some View {
Group {
Print("\(number)")
Text("\(number)")
}
}
}
extension View {
func Print(_ items: Any..., separator: String = " ", terminator: String = "\n") -> some View {
let output = items.map { "\($0)" }.joined(separator: separator)
Swift.print("→ " + output, terminator: terminator)
return EmptyView()
}
}
PlaygroundPage.current.setLiveView(ContentView())
I think it might be that you’re doing something that holds on to the reference of the items longer than you should or. You might try two things.
If possible, don’t pass in those items and remove the binding in the Subview
If that is needed for some reason further down look at any blocks you have where you might be creating a retain cycle that would keep those subviews alive longer than they should. Look up retain cycles in blocks for help, also look in to weak vs strong references. You might have some objects that point to each and never get released.
good luck
It sounds like you’re holding on to a reference you shouldn’t be.
window will be nil if the view of the view controller is not in the view hierarchy. So that can mean you’re making the tableview try to layout either before it’s actually been pushed, or after it’s been popped.
ViewControllerB is likely getting deallocated when it moves off screen. Then when you push ViewControllerB it is a new instance, and your service that updates the table view is likely trying to reference the old View Controller. Your data source probably shouldn’t know anything about the view controllers. If your service doesn’t reference the view controller directly then you may have a retain cycle in the methods that you’re observing the updates.
Don’t set horizontalSizeClass, that fixed it for me.
Why are you setting it anyway? This is a value that is set by the system and probably should not be overridden.
I just got this too. I’ve never seen this before. Any updates?