How to read files on an external drive plugged into the Lightning port

I read that since iOS13 its possible to read an external drive connected via the Lightning port.

Is it possible to read files from myApp? If so how.

Thanks!

Answered by DTS Engineer in 692731022

I'm now fearing that iOS cannot mount a FAT formatted storage device.

iOS can definitely mount FAT volumes over USB. Rather than testing with your app, I recommend that you test with the Files app. If the FAT volume doesn’t show up there, you know that it’s a problem with the mounting process rather than anything related to your code.

If it does turn out to be a problem with the mounting process, I recommend that you retest with a USB thumb drive. If that works and your camera fails, this issue is specific to the camera.

On the USB thumb drive front, you’ll need one of two configurations:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is it possible to read files from myApp?

Yes. To do this, use the document picker API for your UI framework to request that the user choose a file. That’ll give you back a URL that you can then read and write like any other security-scoped URL.

For example, for UIKit you’d use the UIDocumentPickerViewController class.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

I'm now fearing that iOS cannot mount a FAT formatted storage device.

iOS can definitely mount FAT volumes over USB. Rather than testing with your app, I recommend that you test with the Files app. If the FAT volume doesn’t show up there, you know that it’s a problem with the mounting process rather than anything related to your code.

If it does turn out to be a problem with the mounting process, I recommend that you retest with a USB thumb drive. If that works and your camera fails, this issue is specific to the camera.

On the USB thumb drive front, you’ll need one of two configurations:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

is there anyway using any iOS device (like one with a USB-C) or any adapter/cable - so my app could also use PTP to retrieve files?

I don’t think so. PTP support is built in to the OS and AFAIK it has no API.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to read files on an external drive plugged into the Lightning port
 
 
Q