Post

Replies

Boosts

Views

Activity

Debugger error: refcount only available for class types
I want to check reference count for an object, using language swift refcount command in debugger. Sample code: import Foundation class Person {     let name: String     init(name: String) { self.name = name }     var apartment: Apartment?     deinit { print("\(name) is being deinitialized") } } class Apartment {     let unit: String     init(unit: String) { self.unit = unit }     weak var tenant: Person?     deinit { print("Apartment \(unit) is being deinitialized") } } var john: Person? var unit4A: Apartment? john = Person(name: "John Appleseed") unit4A = Apartment(unit: "4A") john!.apartment = unit4A unit4A!.tenant = john john = nil // <-- set breakpoint here unit4A = nil But, when I put breakpoint into john = nil line, paste language swift refcount john command into lldb command line and hit Enter, an error is occured: error: refcount only available for class types Why? Is it broken in latest Xcode Version 14.0.1 (14A400) or am I doing something wrong?
2
0
748
Oct ’22