Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use NSBatchUpdateRequest #32

Open
shardul89 opened this issue May 1, 2019 · 1 comment
Open

How to use NSBatchUpdateRequest #32

shardul89 opened this issue May 1, 2019 · 1 comment

Comments

@shardul89
Copy link

shardul89 commented May 1, 2019

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.

@shardul89 shardul89 changed the title How to use NSBatch How to use NSBatchUpdateRequest May 1, 2019
@shardul89
Copy link
Author

@albertodebortoli I am stuck with some urgent issue. Can you please help me here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant