Source#
Apple Developer Forums — “Crash iOS 26.0: [__NSSingleObjectArrayI selectedMediaOptionInMediaSelectionGroup:]: unrecognized selector sent to instance”:
https://developer.apple.com/forums/thread/800764
Apple documentation:
- AVPictureInPictureController: https://developer.apple.com/documentation/avkit/avpictureinpicturecontroller
- AVFoundation media playback / media selection: https://developer.apple.com/documentation/avfoundation/media-playback
- AVKit: https://developer.apple.com/documentation/avkit
Problem#
A minimal iOS 26 app plays HLS with AVPlayer + AVPlayerLayer. When the layer is also used to create AVPictureInPictureController, repeatedly toggling a legible media option can crash with:
[__NSSingleObjectArrayI selectedMediaOptionInMediaSelectionGroup:]:
unrecognized selector sent to instance
The forum repro creates PiP with:
view.pipController = AVPictureInPictureController(playerLayer: view.playerLayer)and toggles captions using a genuine AVMediaSelectionGroup loaded from the current asset:
player.currentItem?.asset.loadMediaSelectionGroup(for: .legible) { group, error in
if let group {
let option = !isCCEnabled ? group.options.first : nil
player.currentItem?.select(option, in: group)
}
}The supplied UI test toggles the caption control repeatedly to make the failure deterministic.
Evidence level#
DOCUMENTED#
Apple documents AVPictureInPictureController(playerLayer:) as the supported initializer for presenting an AVPlayerLayer in PiP. AVFoundation separately models media selection using AVMediaSelection, AVMediaSelectionGroup, and AVMediaSelectionOption.
AVKit is explicitly responsible for PiP and display of subtitles/closed captions, so interaction between PiP presentation state and legible media selection is within the supported framework surface.
OBSERVED#
The Apple Developer Forums report contains a minimal app and deterministic UI stress test. The crash appears when caption selection is repeatedly mutated while an AVPictureInPictureController is attached to the same AVPlayerLayer.
IMPLEMENTATION EVIDENCE#
The Objective-C exception is unusually informative:
receiver class: __NSSingleObjectArrayI
selector: selectedMediaOptionInMediaSelectionGroup:
An NSArray implementation is receiving a selector whose semantic role belongs to media-selection state. This is evidence of a type/ownership mismatch inside the executing framework path, not an HLS network or decoder failure.
It does not prove which AVKit/AVFoundation object slot became corrupted or stale.
INFERENCE#
A plausible boundary is AVKit's PiP/legible-media synchronization path retaining, publishing, or reading media-selection state with an unexpected object representation during rapid selection changes.
This remains a hypothesis until a symbolicated exception backtrace identifies the caller that sends selectedMediaOptionInMediaSelectionGroup: to the array.
UNKNOWN#
- Exact Apple framework method that sends the invalid selector.
- Whether one toggle is sufficient under a particular timing window or stress only raises race probability.
- Whether the defect requires HLS, or reproduces with file-backed media containing selectable legible tracks.
- Whether active PiP is required, or merely constructing/attaching the controller is sufficient.
- Whether later iOS 26.x builds changed the behavior.
Investigation / Explanation#
Do not start by debugging WebVTT syntax, CDN delivery, or AVPlayerItem decode state. The crash is an Objective-C dispatch failure.
Use this boundary model:
HLS asset
→ legible AVMediaSelectionGroup
→ explicit select(option, in:)
→ AVPlayerItem media-selection mutation
→ AVKit/PiP observes or synchronizes selection
→ internal media-selection representation
→ invalid selector dispatched to NSArray
→ process crash
The first useful question is:
Which object is expected by the caller of
selectedMediaOptionInMediaSelectionGroup:, and why is an__NSSingleObjectArrayIpresent instead?
Capture an Objective-C exception breakpoint and fully symbolicated backtrace. Classify each frame by framework:
app
AVKit
AVFoundation
MediaToolbox/CoreMedia
Foundation
The first Apple media-framework frame above objc_msgSend / exception dispatch is the primary implementation boundary.
Also record on every selection mutation:
monotonic timestamp
AVPlayerItem identity
AVURLAsset identity
AVMediaSelectionGroup identity
selected option identity
currentMediaSelection immediately before/after
PiP controller identity
isPictureInPicturePossible
isPictureInPictureActive
isPictureInPictureSuspended
thread / queue issuing select
Do not assume repeated toggling from the app is itself invalid. The public API accepts explicit media selection; if a supported framework path crashes because an internal receiver has the wrong type, the investigation should locate the internal transition rather than mask it with arbitrary debounce timing.
Verification matrix#
Keep the same asset and caption-selection code and vary one dimension at a time:
A. iOS 18 + AVPlayerLayer, no PiP controller
B. iOS 18 + AVPlayerLayer + PiP controller
C. iOS 26 + AVPlayerLayer, no PiP controller
D. iOS 26 + AVPlayerLayer + PiP controller
E. iOS 26 + PiP controller created but PiP never started
F. iOS 26 + active PiP while toggling captions
G. iOS 26 + HLS/WebVTT
H. iOS 26 + local/file-backed media with selectable legible track
I. toggle on main thread at human speed
J. deterministic rapid toggle stress
Interpretation:
D crashes, C does not
→ PiP attachment is a strong causal discriminator
E crashes
→ active floating PiP presentation is not required; controller/layer integration is enough
F only crashes
→ active PiP state synchronization becomes primary
G crashes, H does not
→ HLS-specific media-selection lifecycle remains relevant
G and H both crash
→ move boundary above HLS parsing/networking into AVKit/AVFoundation media-selection integration
J crashes, I does not
→ timing/reentrancy/race becomes plausible, but still requires stack evidence
Run the same matrix on the affected iOS 26.0 build and latest available iOS 26.x/27 build to establish version scope.
Solution / Guideline#
Until the framework owner and fixed OS version are established:
- Capture and preserve the symbolicated Objective-C exception backtrace before implementing containment.
- Verify that every selected
AVMediaSelectionOptionbelongs to the current item's current legible group. - Serialize app-owned selection mutations on the main actor/main thread and avoid issuing duplicate selection commands while a previous UI action is still being processed; treat this as containment, not a root-cause fix.
- If PiP is optional for the affected screen, A/B disabling PiP-controller attachment is the cleanest version-scoped containment experiment.
- Do not rewrite HLS manifests or WebVTT solely because this exception occurs; first prove HLS-specific causality with the file-backed control.
- File Feedback Assistant with the minimal project, deterministic UI test, exact OS build, exception backtrace, and sysdiagnose/Media Playback logging timestamp.
Do not catch and ignore the Objective-C exception as a production strategy. The process is already executing an invalid internal object/selector relationship.
Reusable engineering rule#
When an Apple media-framework crash names a concrete wrong receiver type, treat that receiver/selector mismatch as the first implementation boundary and use feature-combination A/B tests to identify who owns the bad state.
For this class of issue:
public operation succeeds semantically
→ observer/integration path runs
→ expected internal state object
→ actual runtime receiver type
→ invalid selector
The debugging target is the first point where the expected and actual object types diverge — not the final HLS resource, subtitle bytes, or renderer symptom.
References#
- Apple Developer Forums — minimal iOS 26 repro: https://developer.apple.com/forums/thread/800764
- AVPictureInPictureController: https://developer.apple.com/documentation/avkit/avpictureinpicturecontroller
- AVFoundation media playback and media selection: https://developer.apple.com/documentation/avfoundation/media-playback
- AVKit: https://developer.apple.com/documentation/avkit