Can I parse a file on a USB drive from IOS? (Eg OTG cable to iPhone)

Can I parse a file on a USB drive from IOS? (Eg OTG cable to iPhone). Is USB device that mounts as file system normally, e.g. on MacBook

Which library/framework to use?

Or is it possible from iPad if not from iPhone?

I’m not sure I understand your requirements here. Here’s what I think you’re asking:

  • You have an iOS app running on an iPhone.

  • You have a USB drive formatted in some standard way (MBR partitioned with a FAT32 volume perhaps?).

  • You use some other system to put a file on that USB drive.

  • You want to attach that USB drive to your iPhone.

  • And then write code in your app to read that file.

Is that correct?

Share and Enjoy

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

Yes thats right

OK, so there’s two parts to this:

  • Hardware

  • Software

On the hardware front, most iOS devices don’t have a USB port [1], so you’ll need a Lightning to USB 3 Camera Adapter.

On the software side, access to external file systems is mediated by the iOS sandbox. To read a file on an attached USB drive you’ll need to be granted permission by the user via one of the standard file picking UIs. There are various APIs you can use for this, including the UIDocumentPickerViewController API you referenced. My go-to reference for this sort of thing is WWDC 2017 Session 229 Building Great Document-based Apps in iOS 11.

Share and Enjoy

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

[1] The exception being the most recent iPad Pro models.

Can I parse a file on a USB drive from IOS? (Eg OTG cable to iPhone)
 
 
Q