nothirst / TICoreDataSync

Automatic synchronization for Core Data apps, between any combination of Mac OS X and iOS: Mac to iPhone to iPad to iPod touch and back again.
https://github.com/nothirst/TICoreDataSync/wiki
807 stars 61 forks source link

Syncing same wholestore across multiple devices #10

Closed dcinzona closed 11 years ago

dcinzona commented 12 years ago

I'm assuming that this is the expected result - but it's not working for me. What I noticed was a separate wholestore being created in a unique GUID folder for each device that is set up with syncing. Meaning, that the core data doesn't sync across different devices. I'm assuming I'm missing something or there is a flag somewhere set that makes this happen?

Just looking for some direction or where to look. I'm sure it's not a bug, just a stupid typo on my part.

Also, after the initial setup and download of the database, subsequent changes don't update on dropbox (even though I get notifications on the computer that files have changed).

Maybe it all has something to do with the recentsync issue posted below.

dcinzona commented 12 years ago

I also get these errors in the console every sync: [WARNING] DropboxSDK: error making request to /1/revisions/sandbox/[App Name]/Documents/App Data/RecentSyncs/EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3.recentsync - Path '[App Name]/Documents/App Data/RecentSyncs/EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3.recentsync' not found

I just verified that the files do actually exist.

dcinzona commented 12 years ago

Not sure if anyone can help, but I would love some input!

MrRooni commented 12 years ago

Can you post a dump of your sync directory on Dropbox? If you drag the top most folder into an app like TextWrangler or BBEdit it will produce a directory hierarchy like so:

.com.nothirst.moneywell2.ntssync:
    ClientDevices:
        F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9:
            deviceInfo.plist
        FB601331-542A-4D3A-806A-D8101C1DCB52-11575-000048BCA44F4EAF:
            deviceInfo.plist
    Documents:
        F2F84E98-19F9-48C6-8815-6DABD7184E47-11331-0000484A3CA06560:
            DeletedClients:
            documentInfo.plist
            IntegrityKey:
                C8EA6925-235B-4089-9141-AF9F6D2E4F53-11331-0000484A8E4A1669
            RecentSyncs:
                F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9.recentsync
                FB601331-542A-4D3A-806A-D8101C1DCB52-11575-000048BCA44F4EAF.recentsync
            SyncChanges:
                F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9:
                FB601331-542A-4D3A-806A-D8101C1DCB52-11575-000048BCA44F4EAF:
            SyncCommands:
                F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9:
                FB601331-542A-4D3A-806A-D8101C1DCB52-11575-000048BCA44F4EAF:
            TemporaryFiles:
                WholeStore:
                    F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9:
                        WholeStore.ticdsync
            WholeStore:
                F6961A87-3E3B-4E45-9B7F-CB8673CD3723-11331-0000484868968FD9:
                    WholeStore.ticdsync
    Encryption:
        salt.ticdsync
        test.ticdsync
    Information:
        DeletedClients:
        DeletedDocuments:
    ReadMe.txt

If you haven't looked at the iOS Notebook example yet this may also point you to how your implementation might be different.

In terms of the warning message you are seeing, this is actually coming from the Dropbox SDK and nine times out of ten it is perfectly normal. When TICDS wants to sync a file or folder it first does a check for that file's metadata. If that file doesn't exist on Dropbox we create it, but not before Dropbox warns us that it doesn't exist.

dcinzona commented 12 years ago

Should that warning message come up every time the app tries to sync (even if the directory was already created and I can see those files there?)

Clockbuilder:
    ClientDevices:
        0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
            deviceInfo.plist
        1B6331FA-D973-46F0-9134-99635124DDF2-25297-00000BE9EE0FC1E0:
            deviceInfo.plist
        1B6609A4-4E7B-478D-91E7-25A31A95F161-25098-00000BE494D83148:
            deviceInfo.plist
        1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075:
            deviceInfo.plist
        5B186974-FBBE-46B5-847E-7D9EE1B99D72-86296-00000B2E9A238AE7:
            deviceInfo.plist
        6AF1CE2D-9115-4551-836B-2AD6E37612E7-25162-00000BE6549D76B7:
            deviceInfo.plist
        34D8397C-D1E6-48DA-A5F4-15A1679B6133-24609-00000BCFDFD9C575:
            deviceInfo.plist
        48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82:
            deviceInfo.plist
        52F85114-0891-4A25-8953-7E07D2015EAE-25217-00000BE7E688CF4F:
            deviceInfo.plist
        651E7DD2-4F9C-472A-BA7B-07C29BF37B1D-24553-00000BCCCC64C7D7:
            deviceInfo.plist
        A3FB44C1-B96E-4DC0-8101-3A18282EC1FA-187-0000000B93643B8F:
            deviceInfo.plist
        A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
            deviceInfo.plist
        B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A:
            deviceInfo.plist
        C1DE6B26-6C4B-439D-9026-7B6459B88B1A-25026-00000BE303FAB434:
            deviceInfo.plist
        EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3:
            deviceInfo.plist
        FCA1663C-A3B9-4F1F-876B-228C2F82E3BB-24299-00000BC046A6DB23:
            deviceInfo.plist
    Documents:
        Clockbuilder Data:
            DeletedClients:
            documentInfo.plist
            IntegrityKey:
                0B03B3C4-01CB-44AE-BC63-B0677561BDF9-6643-000041CDA80B1ED4
            RecentSyncs:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F.recentsync
                1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075.recentsync
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51.recentsync
                EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3.recentsync
            SyncChanges:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                    0365014369.493186-F3557520-3F03-4B12-90FB-A04258C890A1-29199-000049E762AC728B.syncchg
                    0365604198.798374-A694CE1A-432E-4F4E-8B34-FF83D6D98F6E-4959-0002625DDD65C2C0.syncchg
                    0365604201.467743-F6D67C72-D682-44A7-95A5-A3804FB1AA38-4959-0002625E7C81D7E5.syncchg
                    0365604206.076269-34E959EE-AEE3-4A04-A84E-E7DBE2350AF9-4959-0002625F8F34890B.syncchg
                    0365604209.368378-8408AF29-88EE-43D2-AC5E-CA471674DE51-4959-00026260536F8045.syncchg
                    0365611463.939683-5CC66F7A-4DB8-404D-82B9-760372477B10-32451-000268F9767139BC.syncchg
                    0365611468.044681-F1D5204C-5E76-46AC-B3A9-5768B7901C3B-32451-000268FA6B1FFBF4.syncchg
                    0365613542.618997-1F72542E-1D36-425E-84F1-F5317E3824F5-39802-00026ADD750DD8B5.syncchg
                    0365613547.628722-B923879E-A389-4BCE-A522-22BAE2B04936-39802-00026ADE9FAA62B2.syncchg
                1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075:
                    0365006653.364391-0FF34388-C5B8-4979-A18F-6F83F5761921-15705-00000495FCEFA5C7.syncchg
                    0365006901.913114-085C177F-F735-43AB-82A8-0DBF8FA1A2DA-15726-00000497607CE835.syncchg
                    0365007157.652970-2487986A-2F59-4F31-BBFC-68AA37B24739-15726-00000498CE53A2C8.syncchg
                    0365007166.110231-E95DD294-2779-4421-A5B8-3EC4E727FEF0-15726-00000498DA6CC685.syncchg
                    0365019281.871631-0FEAC592-2969-49A3-B097-61CB9E1C101E-16433-000004C6C6D77DE8.syncchg
                    0365019470.906640-2F20507E-0E01-4D63-8CE7-346D1422DEB9-16433-000004C7D5422D4A.syncchg
                    0365533940.982587-DA2FEBF8-7DFE-4928-B8EF-D180BC8B50CA-27273-000008CE6307ABB9.syncchg
                    0365685586.606528-97EB0DBA-7BFF-4787-BDEE-55601A3F6520-32283-00000A6D2E2FBBD7.syncchg
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                    0365006222.427661-1C9D3994-E2B2-4929-AA96-8CF8661EC2B7-9156-0000427E715BC0CD.syncchg
                    0365015013.073978-50EAA370-5B82-4573-8079-72B4FDE159A8-30629-00004A7D3C35F0A4.syncchg
                EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3:
            SyncCommands:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075:
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                EB9004E5-9C2D-4FED-A121-6B755FF62A64-8962-00001CA5273817B3:
            TemporaryFiles:
                WholeStore:
                    0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                        AppliedSyncChangeSets.ticdsync
                        WholeStore.ticdsync
                    1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075:
                        AppliedSyncChangeSets.ticdsync
                        WholeStore.ticdsync
                    A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                        AppliedSyncChangeSets.ticdsync
                        WholeStore.ticdsync
            WholeStore:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                    AppliedSyncChangeSets.ticdsync
                    WholeStore.ticdsync
                1CC45C69-EAFF-4133-B927-6E173731BEA4-15673-000004941D2D6075:
                    AppliedSyncChangeSets.ticdsync
                    WholeStore.ticdsync
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                    AppliedSyncChangeSets.ticdsync
                    WholeStore.ticdsync
        Clockbuilder iPad Data:
            DeletedClients:
            documentInfo.plist
            IntegrityKey:
                8FD23325-C33F-4D3A-8596-D25A5635416F-48086-00026C7D416570C9
            RecentSyncs:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F.recentsync
                1B6331FA-D973-46F0-9134-99635124DDF2-25297-00000BE9EE0FC1E0.recentsync
                1B6609A4-4E7B-478D-91E7-25A31A95F161-25098-00000BE494D83148.recentsync
                5B186974-FBBE-46B5-847E-7D9EE1B99D72-86296-00000B2E9A238AE7.recentsync
                6AF1CE2D-9115-4551-836B-2AD6E37612E7-25162-00000BE6549D76B7.recentsync
                34D8397C-D1E6-48DA-A5F4-15A1679B6133-24609-00000BCFDFD9C575.recentsync
                48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82.recentsync
                52F85114-0891-4A25-8953-7E07D2015EAE-25217-00000BE7E688CF4F.recentsync
                651E7DD2-4F9C-472A-BA7B-07C29BF37B1D-24553-00000BCCCC64C7D7.recentsync
                B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A.recentsync
                C1DE6B26-6C4B-439D-9026-7B6459B88B1A-25026-00000BE303FAB434.recentsync
                FCA1663C-A3B9-4F1F-876B-228C2F82E3BB-24299-00000BC046A6DB23.recentsync
            SyncChanges:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                1B6331FA-D973-46F0-9134-99635124DDF2-25297-00000BE9EE0FC1E0:
                1B6609A4-4E7B-478D-91E7-25A31A95F161-25098-00000BE494D83148:
                5B186974-FBBE-46B5-847E-7D9EE1B99D72-86296-00000B2E9A238AE7:
                6AF1CE2D-9115-4551-836B-2AD6E37612E7-25162-00000BE6549D76B7:
                34D8397C-D1E6-48DA-A5F4-15A1679B6133-24609-00000BCFDFD9C575:
                48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82:
                52F85114-0891-4A25-8953-7E07D2015EAE-25217-00000BE7E688CF4F:
                651E7DD2-4F9C-472A-BA7B-07C29BF37B1D-24553-00000BCCCC64C7D7:
                A3FB44C1-B96E-4DC0-8101-3A18282EC1FA-187-0000000B93643B8F:
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A:
                C1DE6B26-6C4B-439D-9026-7B6459B88B1A-25026-00000BE303FAB434:
                FCA1663C-A3B9-4F1F-876B-228C2F82E3BB-24299-00000BC046A6DB23:
            SyncCommands:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                1B6331FA-D973-46F0-9134-99635124DDF2-25297-00000BE9EE0FC1E0:
                1B6609A4-4E7B-478D-91E7-25A31A95F161-25098-00000BE494D83148:
                5B186974-FBBE-46B5-847E-7D9EE1B99D72-86296-00000B2E9A238AE7:
                6AF1CE2D-9115-4551-836B-2AD6E37612E7-25162-00000BE6549D76B7:
                34D8397C-D1E6-48DA-A5F4-15A1679B6133-24609-00000BCFDFD9C575:
                48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82:
                52F85114-0891-4A25-8953-7E07D2015EAE-25217-00000BE7E688CF4F:
                651E7DD2-4F9C-472A-BA7B-07C29BF37B1D-24553-00000BCCCC64C7D7:
                A3FB44C1-B96E-4DC0-8101-3A18282EC1FA-187-0000000B93643B8F:
                A20599E8-8245-4D0A-A25E-4A6C46008974-6643-000041C305157B51:
                B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A:
                C1DE6B26-6C4B-439D-9026-7B6459B88B1A-25026-00000BE303FAB434:
                FCA1663C-A3B9-4F1F-876B-228C2F82E3BB-24299-00000BC046A6DB23:
            TemporaryFiles:
                WholeStore:
                    0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                        WholeStore.ticdsync
                    48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82:
                        WholeStore.ticdsync
                    B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A:
                        WholeStore.ticdsync
            WholeStore:
                0EE55369-1918-4343-AD82-BB9FF33F7997-12297-000043300DA0D32F:
                    WholeStore.ticdsync
                48F4E59E-314A-44B3-92F1-25BD88F70652-94567-00000C3815EA8A82:
                    WholeStore.ticdsync
                B72B569D-910E-45B3-B6EE-A5A3C5408C0A-594-000000091FB8A70A:
                    WholeStore.ticdsync
    Encryption:
        salt.ticdsync
        test.ticdsync
    Information:
        DeletedClients:
        DeletedDocuments:
    ReadMe.txt
dcinzona commented 12 years ago

By the way, every time I make a change to the core data, i do see sync activity increase and then decrease back down to 0. So it is seeing those changes happening and trying to sync, but then when I delete the app from the device and add it again and initialize the sync, those changes revert back to the original. I also do not see any new changes on any new devices (simulator or physical). It just downloads the original wholestore without the changes/updates.

Also, if I manually initiate a sync, the activity increases, looks like it's syncing but when I go through the "new device setup and sync" process, those changes don't come down the pipe.

dcinzona commented 12 years ago

Not sure if you've had a time to look; any ideas?

MrRooni commented 12 years ago

There is a TICDSDocumentSyncManager delegate method called -documentSyncManagerShouldUploadWholeStoreAfterDocumentRegistration: How are you implementing this method?

It sounds like you're hitting a situation that we ran into where after the whole store download you aren't getting any other changes. In that case we had to invoke another sync after the whole store download completed.

dcinzona commented 12 years ago

This is what I have:

I'm assuming I should comment that last part out?

dcinzona commented 12 years ago

So I made that change, and I still receive the same warnings every time I sync as well as I am not downloading any updated themes from the store.

[WARNING] DropboxSDK: error making request to /1/revisions/sandbox/Clockbuilder/Documents/Clockbuilder Data/RecentSyncs/47AA6D6B-5A93-49E0-A96C-D2F9FD6909FF-67637-000402CB52F585D5.recentsync - Path 'Clockbuilder/Documents/Clockbuilder Data/RecentSyncs/47AA6D6B-5A93-49E0-A96C-D2F9FD6909FF-67637-000402CB52F585D5.recentsync' not found

A little more info:

I deleted the entire dropbox directory, unlinked all clients. then relinked my main device (with my themes on it), and synced.

Then I opened the app in simulator (after completely deleting and reinstalling) and linked it to DB - it downloaded the new themes from my main device.

I made a change on my main device and saved and synced.

Ran a sync in simulator and no changes were processed or downloaded....

So it looks like the initial sync works but it doesnt seem to process any changes still (to any other devices).

Every time I save and manually run a sync, I see the activity change and I see a notification on my computer regarding dropbox changing files - so I know it's doing something...

MrRooni commented 12 years ago

Gustavo,

Sorry for the delay. At this point I'm not sure how much more help I can be. I suggest taking a closer look at the Notebook samples for Mac and iOS and seeing how your setup differs from those. If you're seeing the same issue in the samples then that's another issue entirely and one I'll need to focus on.

best, Michael

dcinzona commented 12 years ago

Thanks Michael, I'll take a look and see if I can find anything that could be breaking the default functionality.