I am currently trying to set up our iOS app with the backendless service. Our app is written in Swift and uses the provided Objective-C Header Bridging. Although the compatability with Swift is there, it is very hard to get anywhere with the SDK so far, because there isn’t any documentation on the Swift-enabled functionality.
That being said, I set up a documentation-inspired Swift example of object-saving and get a weird error code:
“AnonymousObject -> setFieldsDirect: (!!! BLOCKED !!!) PROPERTY ‘cause’[<NamedObject: 0x78ec9910>]”
My synctest-class in Swift is the following:
class BLSync: Responder {
func syncObjects() {
let managedObjectContext:NSManagedObjectContext = (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext!
let request : NSFetchRequest = NSFetchRequest(entityName: "Toilet")
let result = managedObjectContext.executeFetchRequest(request, error: nil) as [Toilet]
if !result.isEmpty {
let toilet = result.first
let blToilet = BLToilet(toilet: toilet!)
let responder = Responder(responder: self, selResponseHandler:Selector("responseHandler"), selErrorHandler:Selector("errorHandler"))
let dataStore = PersistenceService()
dataStore.of(BLToilet.classForCoder())
dataStore.save(blToilet, responder: responder)
println("Saved object in Backendless")
} else {
println("Didn't save object in Backendless")
}
}
override func responseHandler(response: AnyObject) -> AnyObject! {
println("\(response)")
return response
}
override func errorHandler(fault: Fault!) {
println(fault.debugDescription)
println(fault.detail)
println(fault.description)
println(fault.message)
}
}
The syncObjects function gets an object from the CoreData context, converts it into a Backendless compatible NSObject and then attempts to safe that object.
What could be wrong with this attempt and would it be possible, that you update your documentation for the Swift language?
Thanks!
Daniel Steiert