Repository navigation
Simulator apps get camera frames via an injected library (fixes #7) - #8
Merged
Merged
Conversation
iOS Simulator capture is a stub on Xcode 26/27 (FigCaptureSourceSimulator returns -12784; AVCaptureDevice lists no cameras, not even the Mac's), so a CMIO virtual camera can never reach a simulator app. - SimulatorInjection/libSimCamInject.dylib (DYLD_INSERT_LIBRARIES, Simulator only): device discovery, device input, session state, video data output, preview layer, QR metadata output, photo output; built-in test pattern when no Mac feed. - Frames shared via /private/tmp/SimulatorCamera/frame.bin (seqlock header). - Mac app writes every frame there (sandbox exception for that folder, camera entitlement); the dylib is bundled in Contents/Resources. - simcamctl feed --pattern|--qr|--image|--camera. Verified on iOS 27.0 and 26.5 simulators: 76-90 frames/3 s at 1280x720, preview shows the feed, QR payload decoded, photo JPEG returned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Simulator apps get frames as soon as SimulatorCamera is open, before any source is picked. Verified headless: the sandboxed Debug app writes the frame file at 30 fps (temporary-exception path works) and an iOS 27 simulator app receives 90 frames/3 s, preview + photo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Simulator frame file now fed from the canonical CVPixelBuffer pipeline. Test pattern goes to simulator apps only (no sink, no camera access); other sources always write the frame file and push to the sink when the extension is reachable, so simulator apps work even before the extension is approved. Re-verified on iOS 27: app pattern 31 fps -> 90 frames/3 s, simcamctl feed --qr decoded by AVCaptureMetadataOutput. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7.
Root cause
The iOS Simulator's capture stack is a stub on Xcode 26/27:
FigCaptureSourceSimulatoranswers every property with error -12784 and has no streaming path.AVCaptureDevicelists zero cameras in iOS 26.5 and iOS 27 simulators — not even the Mac's built-in camera. So a CMIO virtual camera can never reach a simulator app, whatever the extension does.Fix
SimulatorInjection/libSimCamInject.dylib— loaded into the app in the Simulator only (DYLD_INSERT_LIBRARIESin the scheme). Your app imports nothing. It supplies a "SimulatorCamera" device through the normal AVFoundation API: discovery (default,DiscoverySession,devices,deviceWithUniqueID),AVCaptureDeviceInput, session running state + notifications,AVCaptureVideoDataOutput(BGRA sample buffers),AVCaptureVideoPreviewLayer,AVCaptureMetadataOutput(QR),AVCapturePhotoOutput(JPEG). Built-in test pattern when no Mac feed./private/tmp/SimulatorCamera/frame.bin(64-byte header + BGRA, seqlock). Simulator processes read host paths directly.Contents/Resources.simcamctl feed --pattern | --qr TEXT | --image PATH | --camerafor CI / headless use.Verified (Xcode 27, Mac Studio)
Also verified the sandboxed Mac app writes the frame file at 30 fps and a simulator app receives it.
Known limits
🤖 Generated with Claude Code