You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.
I am getting a error when i am using bool or integer as data type of a attributes , its save to the data without showing any errors but then i am trying to retrieve the data its give me a error saying NSUnknownKeyExceptionthis class is not key value coding-compliant for the key
this is my class
class Message: NSObject,Storable{
let database: SwiftyDB! = SwiftyDB(databaseName: AppConfig.DATABASE_NAME)
var id : String?
var body : String?
var status : String?
var timestamp : String?
var isHide : Bool?
var location : String?
var msgType : String?
var roomId : String?
var userId : String?
override required init() {
super.init()
}
func saveMesssage(shouldUpdate: Bool = false, completionHandler: (success: Bool) -> Void) {
database.asyncAddObject(self, update: shouldUpdate) { (result) -> Void in
if let error = result.error {
print(error)
completionHandler(success: false)
}
else {
completionHandler(success: true)
}
}
}
}
can anybody tell me what i am doing wrong here
The text was updated successfully, but these errors were encountered:
Unfortunately, Swift properties aren't key value coding compliant, so all your property types needs to be representable in ObjC when retrieving objects.
Bool? is not a valid ObjC type. I would recommend using either NSNumber?, or Bool instead.
If you need Bool?, you can use dataForType: to get the objects as dictionaries. You can map the dictionary to your object manually, or by using a JSON mapping library. Both should be relatively straight forward :)
I am getting a error when i am using bool or integer as data type of a attributes , its save to the data without showing any errors but then i am trying to retrieve the data its give me a error saying
NSUnknownKeyException
this class is not key value coding-compliant for the key
this is my class
can anybody tell me what i am doing wrong here
The text was updated successfully, but these errors were encountered: