deansyd / icloud_storage

A flutter plugin for uploading and downloading files to and from iCloud
MIT License
42 stars 25 forks source link

PlatformException(E_CTR, Invalid containerId, or user is not signed in, or user disabled iCloud permission, null, null) #41

Open disonwei opened 10 months ago

disonwei commented 10 months ago

[✓] Flutter (Channel stable, 3.16.8, on macOS 14.1.2 23B92 darwin-arm64, locale zh-Hans-US) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.85.2) [✓] Connected device (4 available) [✓] Network resources

I am testing on a real iOS device with iOS version 17.2. I have installed instructions to configure iCloud in Xcode, checked Key-value storage, iCloud Documents, and CloudKit, and selected Containers. I also called the ContainersID in the code. However, an error is being prompted

PlatformException(E_CTR, Invalid containerId, or user is not signed in, or user disabled iCloud permission, null, null)

disonwei commented 10 months ago

You need to enable iCloud Drive in iCloud, rather than the apps using iCloud.

MuhammadUmair786 commented 9 months ago

Add this in your info.plist file.

<key>NSUbiquitousContainers</key>
 <dict>
    <key>iCloud.com.example.MyApp</key>
    <dict>
    <key>NSUbiquitousContainerIsDocumentScopePublic</key>
    <true/>
    <key>NSUbiquitousContainerSupportedFolderLevels</key>
    <string>Any</string>
    <key>NSUbiquitousContainerName</key>
    <string>MyApp</string>
    </dict>
 </dict>

Source: https://developer.apple.com/library/archive/documentation/General/Conceptual/iCloudDesignGuide/Chapters/DesigningForDocumentsIniCloud.html#:~:text=Enabling%20Document%20Storage%20in%20iCloud%20Drive

I am assuming, you configure container and apple signing correctly.