I am getting iOS crash report from Bugnag:
Attempted to dereference garbage pointer 0x8000000000000010
Below is the class which I have in my project
class Presence {
private var userStates = [Int: [String: Any]]()
internal func saveState(state: UserPresenceState, updateTime: Date, for userId: Int) {
let value = ["state": state, "updated_at": updateTime]
let queue = DispatchQueue(label: "mySerialQueue")
queue.sync {
self.userStates[userId] = value
}
}
}
I am getting Attempted to dereference garbage pointer at line self.userStates[userId] = value. Not sure while accessing self or while accessing userStates variable
I am not sure why this is happening and unable to replicate it, how to solve these kinds of problems?
Is there anything know whether a variable is deallocated or not?
Any help much appreciated
FYI I got the same error from bugsnag with below code too
internal func saveState(state: UserPresenceState, updateTime: Date, for userId: Int) {
let value: [String: Any] = ["state": state, "updated_at": updateTime]
self.userStates[userId] = value
}