1 Reply
      Latest reply on Mar 7, 2018 6:19 PM by john daniel
      john daniel Level 4 Level 4 (550 points)

        Is this possible? And if so, how does one do it?

         

        All I need is a handful of NSUserDefaults settings. No CloudKit, no documents, nothing fancy.

         

        So far, I have found the following:

        1) I seem to have the correct entitlement. The default value for com.apple.developer.ubiquity-kvstore-identifier is $(TeamIdentifierPrefix)$(CFBundleIdentifier). I have tried to manually set what those values are, but there is no change in behaviour.

        2) I don't think I can use "Automatically manage signing". It seems to pick my "Mac Developer" certificate and doesn't allow me to change that. This is a Developer ID app, so this seems like a dead end. Just for fun, I tried the automatically managed, wrong certification with no change in behaviour.

        3) I can seem to manually specify the correct Developer ID certificate and it picks up the provisioning profile correctly.

        4) Regardless of how I try the signing, the app won't run from Xcode. All I ever get is "warning: Falling back to contents of entitlements file ... because it was modified during the build process. Modifying the entitlements file during the build is unsupported." As far as I know, I'm not doing anything of the sort. It spits out this message 5 times after copying various embedded frameworks and resources. Eventually I get "Message from debugger: unable to attach" in the console.

        5) If I do an archive, it will run. Obviously it doesn't work. There is no iCloud functionality.

        6) The iCloud tab in Capabilities seems happy.

        7) According to the documentation, it isn't possible.

        8) According to WWDC 2016 "What's new in Security", it is possible.

         

        Any ideas? Hints? Tutorials? Thanks.

        • Re: NSUbiquitousKeyValueStore with Developer ID?
          john daniel Level 4 Level 4 (550 points)

          I created a simple project to test and it worked fine. Here is what I've learned:

          1) It doesn't matter. The default is fine.

          2) I have yet to see "Automatically manage signing" work. Perhaps that is because I'm writing Developer ID Mac apps.

          3) Yes. Manually shoving in correct values seems to work.

          4) No such problems on the demo project. Perhaps I just need to rebuild my mess of a project and this problem will go away.

          5) Works from either archive build or debug. See below.

          6) iCloud Capabilities tab is happy in demo project.

          7) The documentation is wrong

          8) WWDC 2016 is correct

           

          Here is the key point. It may have been working the first time I tried it. iCloud is "smart" about where you are running it. When you save on device A, you will not be able to read on device A. Nothing has changed on device A, so why would you want to get notifications there? But if you run it on device B, you will get the changes from A. If you run both A and B simultaneously, then you can save on one and load on the other.