I have the following situation:
My SwiftUI App for macOS is using App Sandbox and is currently configured for read/write access for all the locations selectable in XCode
I have added a file selector using a button and NSOpenPanel() to let the user select a folder containing a database file, to which I successfully get permissions using URL.bookmarkData() and URL.startAccessingSecurityScopedResource()
I then try to read file paths from the database file and open those but I instantly get a permission error without a permission dialog/prompt appearing
In my test I am using paths to files in my iCloud Drive folder
I added all file/folder related usage string entries to the Info.plist for testing
I think this is weird, since I can paste one of those file:// URLs from the database into a (non-Safari) browser and it shows the native permission dialog/prompt before downloading the file as expected.
Is there any usage string that's not shown in the Info.plist Dropdown in XCode that I need to add to my app in order for this to work?
iCloud Drive
RSS for tagiCloud Drive safely stores any kind of file so it can be accessed in iCloud-enabled apps on iPhone, iPad, Mac, or PC.
Posts under iCloud Drive tag
53 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have my desktop in the iCloud. On a regular basis, my iCloud comes to a point where it wants to upload every single file again, so it sets every existing file on "Waiting for upload", and takes 3 – 5 days to reupload everything. I don’t know what causes this, it comes out of the blue sometimes. During that time, I can’t copy files, and can’t open some programs like Xcode. How can I avoid this?
Just as you can right-click and force a file to 'Download Now', is there a way to force iCloud to prioritise a file to upload immediately?
I unintentionally turned off iCloud Drive on iPhone.
iCloud deleted all my Desktop and Documents files
Then sync deleted all my Documents files from all other devices
iCloud.com website shows an empty folder.
I don’t have any files in the restorable section.
I don’t see any iCloud Archive folder created anywhere on my devices to restore.
The total amount of information stored was quite large, over 25 GB.
I turned back on the iCloud Drive feature, but no data shows up.
I have paid extended storage capacity. There is no way that with the push of a button, data that was stored on iCloud servers would be lost.
Nothing they say seems to help.
Can someone please advise - How to recover data?
I have set up the app identifier in Apple developer with the document URL set up for iCloud and also updated the info.plist file and entitlements according to this.
info.plist
<dict>
<key>iCloud.com.abc.MyApp</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>MyApp</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>NSUbiquitousContainersUsageDescription</key>
<string>This app uses iCloud containers to store and sync documents.</string>
Entitlement.plist
<array>
<string>iCloud.com.abc.MyApp</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.abc.MyApp</string>
</array>
// Then I am using iCloud for CRUD operation in the app
// Code snippet
{
try {
var iCloudDocumentsURL = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);
if (iCloudDocumentsURL != null)
{
var path = iCloudDocumentsURL.ToString().Replace("%C3%97", "x");
var filepath = path.Replace("file://", string.Empty).Replace("%20", " ");
var destinationdirectoryPath = Path.combine(filePath,"MyAppDocuments");
if (Directory.Exists(destinationdirectoryPath))
{
Directory.Delete(destinationdirectoryPath, recursive: true);
}
}
}catch(Exception ex) {
LogHandler.LogError(ex);
}
}
But in Delete operation gives Exception -> System.IO.IOException: Access to the path '/Users/USERABC/Library/Mobile Documents/iCloudcomabc~MyApp/MyAppDocuments' is denied.
I deployed Xcode to iPhone, emulator and iPhone, and iCloud data is synchronized. But I am using testlight for distribution, so I cannot synchronize. I did not respond in iCloud Kit Database developer mode, and now I have changed to production mode, but there is no response, so I cannot synchronize. That's why.
I have a package stored on iCloud Drive and want to list it as a dependency in another package. This worked fine when the package was stored on the Mac hard drive, but moving it to iCloud seems to cause a problem.
dependencies: [ .package(url: "file:///Users/bill/Library/Mobile Documents/com~apple~CloudDocs/Projects/Matrix", from: "0.0.1") ],
This results in an Xcode error message:
x-xcode-log://812C74F5-B7CA-4E15-A87C-E6C9586B0926 /Users/bill/Library/Mobile%20Documents/com~apple~CloudDocs/Projects/Matrix: The source control operation failed because the specified URL cannot be used. Make sure the URL is valid and try again.
Can anyone advise how to make the URL valid, or is storing the package on iCloud Drive not yet possible?
Previously iCloud Drive worked fine on my iPhone (15 Pro), but within the last couple of months it seems to have died. It continues to work fine on other connected devices (iPad, MBP etc), but will not work on iPhone.
This issue seemed to begin roughly around the early 17.4 betas, but was also present in the public release and has continued on to the current 17.5 betas.
I initially noticed WhatsApp couldn't back up to iCloud despite all the options being turned on. I assumed this was a WhatsApp issue. But I've recently noticed that Castro hangs on every single load and then crashes. I know that Castro does an initial call to iCloud to check back-ups etc so I went to have a look at iCloud Drive itself on my device - every single time I open Files, iCloud Drive takes 10-15 minutes to load/show anything. So it seems that iCloud Drive is not "holding" any information/content and is then taking an age to load, which is causing these other apps to time-out and crash.
Turning off iCloud Drive on the device (a 35 minute waiting process) stops the issues and the apps work fine (aside from now not being able to back-up to iCloud as it's off), but resetting, allowing to re-sync again, does not resolve the issue on the device at all, and if it's turned back on, the apps begin to fail again, and even after a full re-sync it takes 10-15 minutes to load every time.
To note; my connection is not an issue, and I have more than enough space on-device to cache/store stuff that's required.
Any thoughts on what could be causing the issue and how to resolve?
Hello,
we are planning to migrate an app that uses iCloud documents to store some documents that the user can upload/download and modify.
In the official overview of App Transfer here, there are information related to CloudKit Containers and KVS but nothing related to iCloud Documents.
The content of iCloud Documents is accessed using FileManager.default.url(forUbiquityContainerIdentifier: containerID) where the containerID has the form iCloud.com.things.things, even if in the official documentation it is written that the identifier must be prefixed with the Team ID.
With this ID the storage works properly and we never experienced problems.
Do you know if migrating an app with this functionality can be problematic? Do you know if the Team ID is somehow used even if not explicitly passed in the call to the function?
Thank you and have a nice day!
It doesn't make sense. I spent a huge amount of money and bought a Macbook Pro with 4 TB storage, so my files became acceptable to me. Now Apple has removed my files from my computer without my permission! And if I need my files, I have to download them ( My files are not 1-2 megabytes. Some of my files are 600 MB., and I have to wait to be downloaded! )
It is a big pain. It is a very bad experience. And I don't want this to happen again and again like before. I need help to solve this issue.
Does anybody know what the "Document Storage" entry in the Privacy settings for an app means?
I recently discovered that the Privacy Settings of my own app nowadays has a "Document Storage" entry, with (for me) the possible choices: "iCloud Drive", "On My Phone", and "Dropbox". I don't know with which version of iOS these appeared.
When "iCloud Drive" is selected (the default), then the explanatory text below it says "Automatically upload and store your documents in iCloud Drive"
My app has no explicit support for iCloud Drive or iCloud in general, and no support for Dropbox. Some of its files are stored in the Documents folder of the app, which is publicly accessible (through the Files app, e.g.)
My users assume that enabling the option will automatically copy those files to iCloud Drive, but that does not seem to be happening.
I have searched half a day for any documentation around this from Apple, but found nothing.
So: does anybody know what that setting does?
And: if it does not do anything, then how can I can make sure it does NOT appear, to not confuse my users?
Hello All,
I happen to remove "Playgrounds" folder from my iCloud drive, and afterwards Playground is no longer functioning but repeatedly crashes.
It was okey before deletion, but now any operation to create or download playground then Playground App crashes all the time.
Issue not resolved even creating same name folder by manual,
Issue not resolved even re-install Playground - folder in iCloud will not created.
I guess I need to fully uninstall PlayGround completely, then start from scratch to let Playground App to hold init step to generate required folder in iCloud, but not sure how to do it.
Please give kind help if anyone knows about this issue, or if anyone knows complete deletion step of Playground.
Best wishes, tons of thanks in advance.
Best Regards,
Issey Hamada
I have an iOS app, based on the Documents Browser.
That app has an iCloud folder, following all the instructions (NSUbiquitousContainers dict in Info.plist, and so on). As far as I can tell, it works for most of the users.
But some users report that, after creating a file in the document browser window, they meet a "file not found" error and the app does not load the file.
As far as I can tell:
the files are created (the counter is incremented, I've see error with "Untitled 3: file not found").
FileManager() sees the files in question.
somewhere inside the app, opening this file fails.
How can I fix this? I'm not sure about the prevalence, but it seems to be rare but very annoying for the affected users.
I have iCloud sync working in the simulator, where I signed in with my Apple ID on two simulators and it syncs fine. But when I upload the same build to TestFlight and install it on two of my physical devices, it does not sync. Each device behaves as if they only have a local store, eg. each can save and load fine locally. I already tried pushing my schema to production, but it still does not work, even when given 24 hours to see if it would sync. I have also tried restarting both devices and deleting and re-installing the app on both devices. I have also confirmed that iCloud is turned on in the settings app for my app.
I saw this post on Stackoverflow, which seems to be related to my issue, but the suggestions there did not work either. I also saw this post:
https://www.hackingwithswift.com/forums/swiftui/swiftui-app-failing-to-sync-cloudkit-data-but-only-in-testflight-version/10714
However I did not understand the accepted answer, and none of the other suggestions worked either.
I have 2 TB iCloud storages plan. I am not able to copy files on this iCloud drive from my External HD in MacBook M3 Pro . It say that "Manage Space" even though I have more than 1 TB free space. What could be a reason for this?
Hello:
We have a problem and we don't know how to solve it.
We have developed the following two App: app1 and app2
Both App have the function of using iCloud.The iCloud container id of app1 and app2 is the same.We use the document storage function of iCloud.
We originally planned to share iCloud data in two app, so we used the same iCloud container, and we released app1 and then app2. Due to the slow progress of app2 development, the related functions of iCloud have not been added to the code yet. But we found a problem.
In the storage management of "setup", iCloud, the display name of app1 is app2's name, not app1's name. This causes many of our users to delete the iCloud data of the application by mistake, resulting in losses.
Now our question is:
What caused the name in app1's iCloud storage management list to be displayed as the name of app2? How should it be solved?
Hello, I'm currently locked out of an old iphone 13 pro max purchased at Apple Store, i've forgotten the icloud account on the device so i can not locate the serial or imei number of the device and i've lost my proof of purchase, the store employee can not access the proof of purchase, the iphone 13 Pro Max is in great condition's. as i turn on the phone it's an Unknown Display. how could i bypass the unknown display or recycle the phone also the phone is running a ios almost 2 year's ago i've payed full price for the device.
I'm trying to get a document style app, backed by SwiftData going using DocumentGroup. I notice that the sample code allows me to move files to iCloud Drive when selecting a file location for my Document. However, no automatic syncing occurs between two instances of the application, running on the same iCloud account and looking at the same file.
One instance of the application will make changes; while the other instance does not see these changes (unless the other changes closes the document and re-open it). I've worked with CoreData+CloudKit sync in the past and this solution required to listen to a silent push notification to receive updates from CloudKit but I cannot find any documentation that explains what needs to be setup for a SwiftData Document-based app to receive such notifications from iCloud Drive.
Are there any examples of this working or any documentation that I could refer to in order to get started with this solution?
In an effort to ensure the safety of my data, I decided to make a backup on iCloud Drive, assuming that this would provide a secure storage solution and an additional copy on my local MacBook Pro. Regrettably, I was not aware that this process would result in the complete loss of all data from my Documents folder on my local machine.
Upon reaching out to the iCloud support team, their attempts to assist were unfortunately unsuccessful. I was informed that while there is a slim chance of recovering data by purchasing a larger iCloud Drive, no guarantees could be provided. This revelation left me questioning the reliability and effectiveness of iCloud Drive as a secure data management tool.
Furthermore, the explanation provided by the support team regarding the iCloud Drive synchronization process added to my dismay. It appears that iCloud Drive deletes the local Documents folder and replicates it in the cloud, only to recreate a new copy on the local machine afterward. The inherent risks associated with such a mechanism, especially when dealing with large files, are alarming and raise serious concerns about data integrity.
I strongly advise against relying on iCloud Drive for substantial data storage. Instead, I recommend using an external hard drive with Time Machine activation for a more reliable backup solution. It is disheartening to realize that Apple's touted iCloud Drive, marketed as a secure tool to prevent data loss, may fall short of its promises, potentially leading users into situations like mine.
I urge the iCloud engineering team to reconsider and improve the synchronization process to mitigate the risk of data loss for users. The current system, as I have experienced firsthand, poses significant challenges and lacks the necessary safeguards to protect users from unforeseen circumstances.
We are considering to use iCloud API on web service.
But we don't have any mobile app on App Store.
In this case, I think it is not possible to use iCloud according to apple's terms of service, but is there any way to use the iCloud on web service only?