Add these values to your info.plist file and change your build number.
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.example.app</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>App name to display in iCloud Drive</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>None</string>
</dict>
</dict>
and add these keys to your entitlements, you will see an error on the iCloud section of capabilities, but its working fine. So DO NOT click the fix button or change it from the capabilities or it will not work anymore.
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.$(CFBundleIdentifier)</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…