To create the CKContainer that will hold all of the app’s records, you first need to enable the iCloud entitlements for your app.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/27184225-cloudkit/lessons/2