Skopelos
Skopelos copied to clipboard
How to use NSBatchUpdateRequest
Here is the sample code that I am using:
let dataStore = SkopelosClient.sqliteStack()
dataStore.writeSync({ context in
// Update Records
let batchRequest = NSBatchUpdateRequest(
entityName: "User"
)
batchRequest.propertiesToUpdate = ["lastname": "T123T"]
batchRequest.resultType = .updatedObjectsCountResultType
do {
let result = try? context.execute(batchRequest)
print("Success")
} catch {
print("Error")
}
}).read({ context in
let users = User.SK_all(context)
print(users)
})
I am trying to batch update using Skopelos library. But its not printing log Success
or Error
. Breakpoint is hitting at line let result = try? context.execute(batchRequest)
but not moving ahead.
Any help will be appriciated.
@albertodebortoli I am stuck with some urgent issue. Can you please help me here.