Copy/Paste files between File App iOS device and External Storage Device

Hi,

The app that I'm developing requires data transfer between iOS device and external device through usb-c cable connection. So I'm trying to copy and paste the file between iOS and external storage device automactically. I've tried using UIDocuementPickerController with bookmark, which gives the url path of connected external storage after user selection for the first selection, but it could not be used directly without user interaction afterwards. Is it possible to use the storage url path automatically after user selection for the first time? How do I achieve that? Thanks in advance

Answered by DTS Engineer in 857440022

On iOS, your app is sandboxed, and hence doesn't have access to a file outside of its app sandbox. When you select the file using UIDocumentPickerViewController (or the SwiftUI counterpart fileImporter), the system automatically extends the app sandbox to the file, which allows the access to your app. From there, your app can grab and save the security-scoped bookmark of the file URL, and use it to access the file next time, without user interaction anymore. See Enabling Security-Scoped Bookmark and URL Access, if needed.

The app sandbox is to protect resources and improve the security. There is no way to bypass the protection, and so the answer to your question is no.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

On iOS, your app is sandboxed, and hence doesn't have access to a file outside of its app sandbox. When you select the file using UIDocumentPickerViewController (or the SwiftUI counterpart fileImporter), the system automatically extends the app sandbox to the file, which allows the access to your app. From there, your app can grab and save the security-scoped bookmark of the file URL, and use it to access the file next time, without user interaction anymore. See Enabling Security-Scoped Bookmark and URL Access, if needed.

The app sandbox is to protect resources and improve the security. There is no way to bypass the protection, and so the answer to your question is no.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Copy/Paste files between File App iOS device and External Storage Device
 
 
Q