0
votes

Trying to get iCloud Core Data to work between separate iOS and macOS apps. I can see that...

1: iCloud core data is working on each app separately (tested on separate devices)

2: apps are sharing a container (documents work ok)

3: drilling into 'Mobile Documents' directory shows the directories shown when iCloud core data connects to be in the same container

Here is the drill down using the Terminal app

iCloud~com~Distribution-Systems-Associates~RWIA     (THIS IS THE CONTAINER NAME)
 CoreData
      testFindItStore       (THIS IS THE DATA STORE NAME)                                                         
           joeruth~50BDB140-65A8-5D85-B5A2-AD5EA59FE89C   (macOS URL)
           mobile~727D323E-9EFA-4C40-BE69-7ABB9913325B    (iOS URL)

However, it doesn't work between the two apps. I read that the 'primary' app needs approved by the app store before any sharing can go on. Is that true or not? Should there be two directories under testFindItStore or just one? SHOULD there be two directories and the data change are communicated between each via iCloud?

Here are the log messages from each app when they connect to iCloud:

This is the Mac app log...

2016-11-09 20:54:24.455 Remember Where It's At for Mac V3[64763:3708924] -PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:: CoreData: Ubiquity: joeruth~50BDB140-65A8-5D85-B5A2-AD5EA59FE89C:testFindItStore Using local storage: 1 for new NSFileManager current token 2016-11-09 20:54:25.415 Remember Where It's At for Mac V3[64763:3709018] -PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:: CoreData: Ubiquity: joeruth~50BDB140-65A8-5D85-B5A2-AD5EA59FE89C:testFindItStore Using local storage: 0 for new NSFileManager current token

This is the iOS log...

2016-11-09 20:53:00.308265 Remember-Where-Its-At[299:21901] -PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:: CoreData: Ubiquity: mobile~727D323E-9EFA-4C40-BE69-7ABB9913325B:testFindItStore Using local storage: 1 for new NSFileManager current token <2d17fda1 4ca8021b 7e3217c3 0d17701e 681b666b> 2016-11-09 20:53:00.591029 Remember-Where-Its-At[299:21902] -PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:: CoreData: Ubiquity: mobile~727D323E-9EFA-4C40-BE69-7ABB9913325B:testFindItStore Using local storage: 0 for new NSFileManager current token <2d17fda1 4ca8021b 7e3217c3 0d17701e 681b666b>

1
FWIW, iCloud in Core Data has been deprecated as of iOS 10 and macOS 10.12. If this is a new feature, you might want to consider using some other approach.Tom Harrington
I'm not sure if that's true. Some of the properties were depreciated but I'm seriously in doubt that iCloud in Core Data was entirely depreciated. If so, then why is it working with these apps? I think you got some bad info but I will check just to be sure.joseph ruth
The iOS app is just about done. If I put it up and it's accepted by the app store then I think it's safe to say that iCloud Core Data's reported demise might have been a little premature.joseph ruth
Deprecated doesn't mean not working, it means that it's discouraged for new development and is a warning that its end of life is planned. With every single iCloud Core Data symbol deprecated though, it's clearly a deprecated system.Tom Harrington
Thanks for that. Thing is just about done and if I need to fix it to use the iCloud Core Data replacement, I'll do that. I think the target though for the app needs to be iOS 9.3. App store won't accept iCloud Core Data app with a target of iOS 10.joseph ruth

1 Answers

0
votes

Finally got it to work. Problem was that I had changed the data model in both the iOS and macOS. I had thought that because the new models were identical that they would sync. Turned on verbose logging and found that while the DCT file were being processed on the Mac, they were being skipped because the the model versions didn't match. I then deleted the model in the Mac and directly imported the model from the iOS application. Ran it again and this time it didn't skip the updates because of the mismatch but because the system thought that the updates were already applied. Change the name of the local data SQL database and that did it.

Works like a champ now.

Note about depreciation... I'm thinking WWDC 2017 is going too be very interesting. Whatever is driving the Note application (it's not email any more) will be released to the developer world. Don't know any of that for a fact but it's my suspicion. We'll see.