5

I have these two apps, one iOS and one Mac OS X each with a different Bundle ID.

In order for the two apps sync and share the files I had to add the ubiquity container of the iOS app to the list of ubiquity containers in the Mac OS X app.

In the Xcode summary for the Mac OS X app I can't add its own Bundle ID as a ubiquity container. The Mac OS X app will store new added files in its own ubiquity, and so they're inaccessible to the iOS app.

How can I correctly set up both apps so they share and sync all added files using the same ubiquity container?

Sam Spencer
  • 8,492
  • 12
  • 76
  • 133
fundidor
  • 207
  • 3
  • 12

2 Answers2

1

For my own iOS/Mac app pair, I just had my iOS app with the BundleID com.alexanderwinn.Example and the Mac app with com.alexanderwinn.ExampleMac, but they both shared the ubiquity container com.alexanderwinn.Example. Neither of them, not even the Mac version, had a ubiquity container based on the Mac BundleID. I'm a beginner so I can't fully detail the reasoning behind how everything works and breaks, but it's working fine for me!

Nerrolken
  • 1,975
  • 3
  • 24
  • 53
1

To allow multiple apps to access the same data store / ubiquity container, you'll need to do a few things. First, you'll need to open up your Xcode project and follow these instructions (official Apple document here):

  1. Open your Xcode project and then navigate to the project target settings. Click on the Capabilities tab to open up the project settings for extra Apple services. Xcode 5.0 Project Capabilities
  2. Then turn the iCloud option ON. The Ubiquity Container ID should be the same in every app which you need to share data with. The bundle ID's of apps you share data with do not have to be the same, but they both need the same Ubiquity Container ID and team ID. Xcode iCloud project ubiquity container
  3. To start using iCloud in all of your apps with the same iCloud container you'll need to create URLs with your team ID and container ID. Apple sums this up nicely:

    To retrieve a URL for a ubiquity container, you must pass the fully qualified string to the NSFileManager method URLForUbiquityContainerIdentifier:. That is, you must pass the complete container identifier string, which includes your team ID, that you see in the .entitlements property list file. You can pass nil to this method to retrieve the URL for the first container in the list.


Then, setup something called an iCloud Display Set in iTunes Connect. This allows you to create a Display Set ID which can then be shared between your apps so they can access the same data. Here are a few useful links to get you started:

Here's how to setup an iCloud Display Set:

  1. Go to iTunesConnect and open the Manage Applications Section
  2. At the bottom of the page, follow the link to iCloud Display Sets
  3. Click Create New to add a Display Set
  4. Fill out the required information, including the ID:
    enter image description here

Then just attach it to your apps! Hope this helps, good luck.

Community
  • 1
  • 1
Sam Spencer
  • 8,492
  • 12
  • 76
  • 133
  • All the info says that this only links your apps when you submit them to the App Store(s). How can you test Mac <-> iOS while in development? (I added one for my apps and Mac->Mac works iOS->iOS works, but not Mac<->iOS) – kdbdallas Nov 08 '13 at 22:13
  • @kdbdallas I've updated my answer with new information. Check it out. – Sam Spencer Nov 09 '13 at 01:51