I want to access data from a USB device attached to an iPad on that iPad. So far, I've written a basic app that detects whether files exist or not on the iPad. However, it says the /dev/tty.iap file does not exist when I connect the USB device to it.

Is there an entitlement issue for this? Or is this a TCP/IP issue?

Again, the ultimate goal is to read the file, but it's not even detecting it.

  • iOS apps are sandboxed to access only the bundle content and it is generally not possible to access the iOS/iPad filesystem directly. Can you specify how are you detecting in your app, whether the file exists or not? – Nimesh Neema Mar 19 '19 at 17:29
  • @NimeshNeema I have a c++ file with a function that defines FILE * f = open("/dev/tty.iap","r") (or whatever file path I made) and then below that an if statement that says if(f){ theMessage = 1;} else{ theMessage = 0;} and the function returns theMessage. Then in my ViewController.swift file a UIAlertController pops up a message that is that number when you tap a button I made on screen – Lou Mar 19 '19 at 17:38
  • @NimeshNeema I can read /Developer/ directory files without issue. – Lou Mar 19 '19 at 17:39

The most important here is not how to access /dev/try.iap, rather it is that you seem to have misunderstood what it is used for. It does not give you access to USB-drives or their files at all. Even if you could access through some means, it won’t do what you hope.

/dev/tty.iap provides access to the serial communication line inside the old 30-pin connector. This means that it cannot be used with USB at all - only with serial (RS-232) communication, and it is only there on very old iPads (the first, second and third generations). An iPad from 2012 or later does not have the connector.

| improve this answer | |
  • Do you know what the new device node is for current gen hardware? – Lou Mar 19 '19 at 21:04
  • @Lou There's no serial connection available in the Lightning connector, nor in the USB-C connector. So there's no corresponding device node for current gen hardware. – jksoegaard Mar 19 '19 at 23:37

No, you can't read /dev/tty.iap file on an iOS device. At least as long as the device isn't jailbroken.

3rd party iOS apps are sandboxed and not allowed to read the device filesystem.

From File System Programming Guide:

The iOS file system is geared toward apps running on their own. To keep the system simple, users of iOS devices do not have direct access to the file system and apps are expected to follow this convention.

Unofficially speaking, iOS however allows read-only access to some parts of the filesystem as noted in this reddit thread:

Hello everyone, I’m an aspiring security researcher, and got bored. I decided to look at how far the sandbox really lets you go in terms of accessing parts of the filesystem that aren’t part of its designated container.

PLEASE NOTE: In NO WAY does this at all allow you to modify, add, or delete ANY files in the areas I am about to talk about. These areas in the system are, in UNIX terms, “Read-only”.

Which directories can you view?

After combing the filesystem using an app I’ll mention later, these are the directories.

  • /System/Library

  • /usr/lib

  • /Developer

The above explains, why you are able to read /Developer and can't read /dev/tty.iap.

| improve this answer | |
  • My questions based on this would be: how do apps that let you read USB thumb drives plugged into an iPad work? Where is the mount point for that? How did they develop apps to handle that? For example: SanDisk has an app that lets you move files directly from an iDevice: sandisk.com/home/mobile-device-storage/ixpand. How did they write an app to access the USB port without jailbreaking? – Lou Mar 19 '19 at 19:20
  • @Lou They do so by enrolling into MFi Program. The connected storage device can only be accessed by the app developed by manufacturer. – Nimesh Neema Mar 19 '19 at 20:03

Not the answer you're looking for? Browse other questions tagged .