0

As you know in CCEP we are adapting the SDK more and more to our internal applications so we decided to use MobileSync and SmartStore to handle all the sync mechanism.

So far so good, but we are facing an issue that I am sure it is easy to solve but we don't find it.

There we go:

  • We login and call all the syncs targets and store them into SmartStore
  • We logout and don't close the app
  • We login again and call again all the syncs for a different or same user
  • Then the app now tries to call again all the syncs and store them but failing giving us this error:
2020-02-27 13:39:17.075196+0100 RedOne[39363:1173432] [MobileSync] CLASS: SFMobileSyncSyncManager SyncNotExistError: Sync accountSyncDown does not exist
2020-02-27 13:39:17.075632+0100 RedOne[39363:1174222] error opening!: 14
2020-02-27 13:39:17.076073+0100 RedOne[39363:1174222] FMDatabaseQueue could not reopen database for path /Users/adrian/Library/Developer/CoreSimulator/Devices/911FD021-269D-4248-A7F8-65397BCEE39E/data/Containers/Data/Application/836FA425-70F0-4541-BE2B-81E4F454BE1B/Documents/com.ccep.opt.RedOne/00D1l0000000VjJEAU/0051l000002cLic/internal/stores/defaultStore/store.sqlite
2020-02-27 13:39:17.077157+0100 RedOne[39363:1174222] [MobileSync] CLASS: SFMobileSyncSyncManager Sync eventSyncDownLast20 not found
2020-02-27 13:39:17.077262+0100 RedOne[39363:1174222] [MobileSync] CLASS: SFMobileSyncSyncManager SyncNotExistError: Sync eventSyncDownLast20 does not exist
2020-02-27 13:39:17.077296+0100 RedOne[39363:1173428] error opening!: 14
2020-02-27 13:39:17.077797+0100 RedOne[39363:1173428] FMDatabaseQueue could not reopen database for path /Users/adrian/Library/Developer/CoreSimulator/Devices/911FD021-269D-4248-A7F8-65397BCEE39E/data/Containers/Data/Application/836FA425-70F0-4541-BE2B-81E4F454BE1B/Documents/com.ccep.opt.RedOne/00D1l0000000VjJEAU/0051l000002cLic/internal/stores/defaultStore/store.sqlite
2020-02-27 13:39:17.078314+0100 RedOne[39363:1173428] [MobileSync] CLASS: SFMobileSyncSyncManager Sync eventSyncDownMyCalendar not found

Seems like we are not cleaning something when we are doing logout but we checked all the sample applications you have with forceios and we don't see anything special you do when you logout. We are not sure if we are missing something here.

If we do the same steps above but with this difference, then it is working fine:

  • We login and call all the syncs targets and store them into SmartStore
  • We logout and close the app
  • We login again and call again all the syncs for a different or same user
  • Then the app now tries to call again all the syncs and store them but working as expected

I hope you can help us understanding the issue. Please, let us know if you need any further information.

Cheers

Maximo

1

The application should be careful not to hold on to instances of smartstore or mobile sync manager after a logout. The fact it works on restart means it is probably what is going on. One way to achieve that is to avoid capturing the sync manager or smartstore in a instance variable and instead use a helper method like the following:

func getSmartStore() -> SFSmartStore {
    return SFSmartStore.sharedStore(withName: kDefaultSmartStoreName) as? SFSmartStore;
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.