我必须创建一个用于存储strUserValue的计算属性,并将其发送到Web服务。将strUserValue发送到服务时,我遇到userValue.getter错误。我已附上以下代码片段:
class Networking:NSObject
{
private var strUserValue = String()
var userValue: String {
get {
if strUserValue != "" {
return strUserValue
}
else {
if let token = StrongBoxController.sharedInstance.keychainStore.unarchive(objectForKey: "userValue") as? Data {
strUserValue = StrongBoxController.sharedInstance.convertDataToString(value: token)
return strUserValue
}
else {
return ""
}
}
}
set {
strUserValue = ""
StrongBoxController.sharedInstance.saveValues(value: "\(newValue)",key: “userValue”)
}
}
}
>>崩溃:Networking.userValue.getter
malloc:***对象0x281983090的错误:指针未释放 已分配
崩溃:com.apple.root.background-qos 0 libsystem_kernel.dylib
0x1c39caefc __pthread_kill + 8 1 libsystem_pthread.dylib
0x1c38ead10 pthread_kill + 196