I am having the problem, that URLForUbiquityContainerIdentifier is returning nil in some cases even if the user has set up everything correctly in the settings. My code:
Today I experienced this problem again.
This time it was because I had an invalid provisioning profile.
On the developer site, I had to generate a new provisioning profile. Afterward reload the provisioning profiles within Xcode5. Now URLForUbiquityContainerIdentifier
again returns valid urls.
Enable "iCloud Drive" in the iPhone's Settings