(Error) Add the iCloud feature to your App ID.
(Error) Add the iCloud Containers to your App ID.
(good) Add the iCloud entitlement to your entitlements file
(good) Link Cloukit.frameworks.
I added iCloud in Apple Developer Account. Added Container in Apple website.
It even recognized my custom container and loaded it in Xcode, but still shows an error. Rebooting Xcode and mac did not help.