Can not visit iCloud Documents directory in Widget extension iOS16.1 beta

On iOS16.1 beta.

In my widget extension, FileManager.default.url(forUbiquityContainerIdentifier: nil) always return nil.

In the previous iOS versions(iOS16.0 iOS16.0.1) it worked. My app is ScriptWidget, after enable iCloud, the widget can not visit scripts in iCloud Documents directory. But the main app and extent worked as before (can visit).

I also post a feedback https://feedbackassistant.apple.com/feedback/11529890

The Developer documentation says:

Do not call this method from your app’s main thread. Because this method might take a nontrivial amount of time to set up iCloud and return the requested URL, you should always call it from a secondary thread. To determine if iCloud is available, especially at launch time, check the value of the ubiquityIdentityToken property instead.

Are you calling it from the main thread? What does the ubiquityIdentityToken property return?

It literally says:

Do not call this method from your app’s main thread ... you should always call it from a secondary thread

Have you tried that?

Can not visit iCloud Documents directory in Widget extension iOS16.1 beta
 
 
Q