Detect when an iPhone/iPad is connected

I found the method once before in the Apple Developer docs so I know it exists.

Searching for it now online bears no fruit.

Super grateful for any leads on this.


Answered by mikeumus in 668189022
From RayWenderlich.com Discord:


Roberto Machorro — Today at 1:55 PM
Under macOS you use the NSWorkspace API for that, there is an NSNotification called didMountNotification https://developer.apple.com/documentation/appkit/nsworkspace/1534471-didmountnotification


Accepted Answer
From RayWenderlich.com Discord:


Roberto Machorro — Today at 1:55 PM
Under macOS you use the NSWorkspace API for that, there is an NSNotification called didMountNotification https://developer.apple.com/documentation/appkit/nsworkspace/1534471-didmountnotification


Turns out didMountNotification didn't solve it.

didMountNotification works for USB Devices that mount, but iPhones don't mount. Until you use something like ifuse to mount the phone but I didn't want to have to loop ifuse looking for connected iPhones/iPads.

I don't see how I can mark my reply above as not the answer.
Detect when an iPhone/iPad is connected
 
 
Q