How to sync data between different users of a App?

Discussion in 'iOS Programming' started by mikezang, Mar 23, 2012.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I want to know if it is possible, a app use SQLite to save data, user can add or modify data, when a user update data, others users of the same app will get the newest data.
    is this possible? and what can I do next?
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    Sure it's possible. It's also a lot of work for the developer and a difficult thing to pull off well according to things I've read and heard.

    If your users are local to each other you could use bluetooth or a local wireless connection. If you are talking about remote users, then you need to come up with a server solution.

    The real challenge of syncing is in accurately identifying which change is the correct one or if two changes should somehow be merged.

    Good luck.
     
  3. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #3
    This can be a really hard issue. In networking, if someone is editing a record, others are usually locked out or their edits are not confirmed.
    When you have wide open editing with no central control, you have all kinds of issues.

    It's really an issue of the data's usage.

    Example: Right now I'm adding a record to this thread, if someone else adds to this same thread at nearly the same time, which post comes 1st? Answer: it really doesn't matter which one comes 1st.

    I think you need to look at the specific usage of the data. You might look at having a 'confirm updates' and have a token on each record. If they can't gain control of the token, the can't confirm the updates.

    Again it really depends on the usage.
     
  4. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #4
    Here are some idea what I am thinking.
    1. Any user can add a new record
    2. User can only modify record what he/she created.
    3. Onwer(me) can modify all records.

    I want to how to communicate between all users, do you have any idea to solve such problems?
     
  5. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #5
    Actually that sound simple. It sounds like a free to view for all, only some get to edit.

    Depending on what tool you use to store the data, it should have some kind of permission levels or you can write that yourself.

    Example: have data records set so that everyone can read, anyone can ask to write. Once they ask to write, compare their ID to the ID of the thread starter. If it doesn't match, they can't edit.

    You can display the information and have an edit button that allows them to ask for edit permission.
    This would be like most forums, you can look all you want, but can't post until you sign up.

    What tool are you using for the data store.
     
  6. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #6
    That is what I want to know, is it possible to use SQLite to store data?
    I don't want to use a server with DB to store data.
     
  7. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #7
    More information is needed. Are all your users going to communicate when they are on the same local network or via bluetooth? If they can all be remote, then you'd need some service to at least coordinate communication. Are all the users going to have a copy of the data? If so, then how will you know who the owner is?

    Think this through some more. Draw it on paper if you need to.
     
  8. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #8
    When owner created a record, he has to input his email address, that is a key to check if his owner for that record.
    I mean all users are in remote. And with one copy of data.
     
  9. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #9
    Those two bolded sentences conflict given the little we know. It appears you want multiple users to be able add any number of records, allow each user to edit their own entries, and have a master user who can edit all entries. That is usually done by use of a database backend, a front end entry screen, and perhaps some middleware layer.

    The common databases to use are MySQL and Postgres.

    Using an email address as an identifier isn't terrible, but you should have a password to go with it, otherwise you are asking to be cracked.
     
  10. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #10
    You might want to look at a forum package. Something like this one (MacRumors) See if you can control who can edit postings.

    I'm not saying you can't do this without a using a server, but it really sounds like you need a server.

    What did you have in mind for a central datastore?

    You could store the database on 1 device and then have the users upload that each time, but this would be real clunky.

    A central data deposit seems to be needed based on what you've posted so far.
     

Share This Page