Reputation: 8527
When accessing the iCloud ubiquity container in my iOS app I get the following message:
Unknown platform linking against CloudDocs framework 7
It happens when I execute the following code:
FileManager.default.url(forUbiquityContainerIdentifier: nil)
My project is built with SwiftUI on Xcode 14.2.
It is running on an iOS Simulator.
It doesn't matter wether iCloud is set up correctly or not (Capabilities/iCloud container/enabled on device).
I get the same message whether that call returns a URL or nil.
Upvotes: 3
Views: 617
Reputation: 3664
I'm not sure from the wording of your original question if you're experiencing the issue on a simulator, device, or both. If you are on a simulator though, my suggestion would be to try your code on an actual device and see what happens as it may be due to running on the simulator.
I've been having a similar issue and discovered that the culprit for me was the use of NSMetaDataQuery (as noted in my reply comment above). In my case, as soon as I call startQuery() on the simulator I get multiple repeats of the same error message you're seeing. However, on an actual device everything works as expected.
I've tested use of NSMetaDataQuery with a number of simulators and devices from iOS 12 - iOS 16:
This appears to be one of those (yet again) subtle, somewhat undocumented hidden differences between the simulator and an actual device and may apply to your case as well.
What's frustrating is that all of the iCloud functionality otherwise works as expected on all versions of the simulator. As long as the simulator is running iOS 12 or the code doesn't use NSMetaDataQuery, I can iCloud sync across devices in the simulators just fine.
Upvotes: 1