Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Detect if a file or folder is synced by cloud providers (Google Drive, iCloud, OneDrive, Dropbox, etc.) in iOS (all versions)

Hi all,

I’m building an iOS app where I need to determine user picked files or folders using UIDocumentPickerViewController, whether the selected item is synced or managed by a cloud storage provider such as:

  • Google Drive
  • iCloud Drive
  • OneDrive
  • Dropbox
  • or any third-party File Provider extension

My intent is to detect this and optionally warn the user that the item may be subject to syncing behavior.


So far, I’ve tried a few different approaches:

  1. Extended Attributes (listxattr / getxattr) While this does not give reliable outcome.

  2. Heuristically search for keywords like 'Drive', 'GoogleDrive' etc But this is also not reliable.


Question

Is there any possible reliable and documented way to detect programmatically if a file/folder is cloud-synced or managed by a File Provider from within a regular iOS app (not an extension), especially for:

  • Google Drive
  • OneDrive
  • Dropbox
  • iCloud
  • Other third-party providers?

Also, is there any recommended fallback strategy for iOS versions prior to 17 where NSFileProviderManager may have limitations?

Any input from Apple engineers or those who have tackled this would be hugely appreciated!

Thanks in advance 🙌

Answered by DTS Engineer in 835855022

Is there any possible reliable and documented way to detect programmatically if a file/folder is cloud-synced or managed by a File Provider from within a regular iOS app (not an extension), especially for:

Yes, I think so. Two keys in particular:

  1. NSURLIsUbiquitousItemKey-> This means an object is under the "control" of iCloud Drive or a File Provider.

  2. NSURLUbiquitousItemIsExcludedFromSyncKey-> This tells you if the object has been excluded from syncing by iCloud Drive or a File Provider.

However, I will warn the that the word "reliable" is tricky here. Fundamentally, when your opening objects that your app doesn't control... your app doesn't have control over those objects. There are nearly endless edge cases here and this only covers one specific (though obviously common) case.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Accepted Answer

Is there any possible reliable and documented way to detect programmatically if a file/folder is cloud-synced or managed by a File Provider from within a regular iOS app (not an extension), especially for:

Yes, I think so. Two keys in particular:

  1. NSURLIsUbiquitousItemKey-> This means an object is under the "control" of iCloud Drive or a File Provider.

  2. NSURLUbiquitousItemIsExcludedFromSyncKey-> This tells you if the object has been excluded from syncing by iCloud Drive or a File Provider.

However, I will warn the that the word "reliable" is tricky here. Fundamentally, when your opening objects that your app doesn't control... your app doesn't have control over those objects. There are nearly endless edge cases here and this only covers one specific (though obviously common) case.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Detect if a file or folder is synced by cloud providers (Google Drive, iCloud, OneDrive, Dropbox, etc.) in iOS (all versions)
 
 
Q