• When I try to syncUp a locally updated document as detailed below, iwth .leaveIfChanged as a the sync option it does not work.
  • I investigated why this was occurring and could trace the error to the fetchLastModifiedDate method, which fails to retrieve the record from the server, returning a 404.
  • As consequence lastModifiedDate is nil and the function which uses the lastModifiedDate says that the local record is older than that on the server, and so the sync up ultimately fails.
  • The issue I guess is at SDK level as I am able to find the record with the Id passed from the Developer Console (in Salesforce) and via a RestClient request following SQL query in the app.
  • I havent had much luck either with syncing up new records

Below is my code

       let store = SmartStore.shared(withName: SmartStore.defaultStoreName),
       let syncManager = SyncManager.sharedInstance(store:store) else {

let syncOptions = SyncOptions.newSyncOptions(forSyncUp: ["Name",
                                             mergeMode: .leaveIfChanged)
syncManager.syncUp(options: syncOptions, soupName: "Contact") { (syncState) in
    switch (syncState.status) {
    case .done:
        os_log("Sync Done")

I've checked on the server, a record with that Id exists. I've checked the request before it goes and the Id is there. Been stuck on this one for a while.

1 Answer 1


Please checkout the SmartSynExplorerSwift application for a fully functional example of a swift application that uses SmartSync. https://github.com/forcedotcom/SalesforceMobileSDK-Templates/tree/master/SmartSyncExplorerSwift

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .