Morten J Morten J - 4 months ago 32x
iOS Question

Recording an iOS device's screen from an OSX cocoa app with a lightning cable

It's possible in Quicktime, with New Movie Recording > Camera dropdown > select iOS device. AppShow and Screenflow both do it.

I've tried this


tell application "QuickTime Player"
set myrec to new movie recording
tell myrec
set current camera to video recording device named "Morten's iPod touch"
end tell
end tell

But this gives me

error "QuickTime Player got an error: Can’t set video recording device \"Morten's iPod touch\" of document \"Movie Recording\" to video recording device named \"Morten's iPod touch\" of document \"Movie Recording\"." number -10006 from video recording device "Morten's iPod touch" of document "Movie Recording"

Since iOS devices appear as cameras in Quicktime, I figured it would be a capture device in AVFoundation, but this code

for device in AVCaptureDevice.devices() {

Just gives me my Facetime HD camera and a microphone.


You must opt in to see iOS screen devices in your OS X app.

See "How do I set up a mirroring session between iOS 8 and Yosemite?"

CMIOObjectPropertyAddress   prop    = {
UInt32                      allow   = 1;

CMIOObjectSetPropertyData(kCMIOObjectSystemObject, &prop, 0, NULL, sizeof(allow), &allow);

You can get the list of devices using:

NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed];