0

I created first simple iOS app using Xamarin & Sqlite database as backend. Everything works fine, now my next step is to figure out how to make data stored in sqlite available on more than 1 user's devices. Since sqlite database is stored locally on user's device, do i need to code and syncing or just rely on user to enable icloud and data just sync itself? My understanding on this is still entirely muddy. If I need to write code to do syncing, could you give some example code? You help is greatly appreciated. -Thanks

Below is code i used to create database:

 var fileName = "TrackItem.db3";
 var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
 var libraryPath = Path.Combine(documentsPath, "..", "Library");
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
HaiNguyen
  • 312
  • 2
  • 10
  • 1
    Possible duplicate of [iPhone (iOS) app using local sqlite and desire to sync between multiple devices](https://stackoverflow.com/questions/9146943/iphone-ios-app-using-local-sqlite-and-desire-to-sync-between-multiple-devices) – ProgrammingLlama Dec 04 '17 at 04:53
  • Thanks I see the post just now, but it didn't have any example coding (if any) on how to go about enable iCloud. I did go thru apple and enable iCloud on the app, but what else do I need? – HaiNguyen Dec 04 '17 at 05:00
  • developer.xamarin.com/guides/ios/data-and-cloud-services/ The core issue is going to be if a user is able to edit the database on multiple devices, you could treat the sqlite file as an UIDocument but again changes from multiple devices will cause a corrupted sqlite db.. typically you are better off maintaining database changes (deltas) in unique json files, use them as UIDocuments and flag your DB with SetSkipBackupAttribute, then when "new" doc shows up you handle sync'ing them in the DB. I use CoreData or Realm for sync, but CoreData has been and continues to troublesome for iCould sync'ing – SushiHangover Dec 04 '17 at 05:25
  • Saying I keep sqlite db locally on individual device, store changes (deltas) using UIDocuments, what is a typical content of a unique jason file look like? - Thanks in Advance! – HaiNguyen Dec 12 '17 at 20:55

1 Answers1

0

sqlite is only used for loclly, try using firebase