I have researched this extensively. After hearing the news about Parse the other day, I have been toying around with using Kinvey for my BaaS. I am trying to save an object but I received an error related to KCSPersistable.
class Event : NSObject{
var entityId: String? //Kinvey entity _id
var name: String?
var date: NSDate?
var location: String?
var metadata: KCSMetadata? //Kinvey metadata, optional
}
func hostToKinveyPropertyMapping() -> [NSObject : AnyObject]! {
return [
"entityId" : KCSEntityKeyId, //the required _id field
"name" : "name",
"date" : "date",
"location" : "location",
"metadata" : KCSEntityKeyMetadata //optional _metadata field
]
}
Swift calls it redundant to an NSObject due to the superclass. I removed the KCSPersistable declaration and the code will build successfully, however now I receive the following error:
'Object "<KinveyPractive.Event: 0x7fed18d484c0>" of type "KinveyPractive.Event" does not implement 'hostToKinveyPropertyMapping', a required 'KCSPersistable' method for saving the object to the backend'
I am running into a loop of issues. If I remove KCSPersistable, Xcode asks for it. However, if I leave it, Xcode won't compile.
The problem you saw was because NSObjects in Kinvey implicitly implement KCSPersistable.
We've corrected our documentation to reflect this. Please use the following sample in place of your code -