hex/ios/HEXMobile
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel 5552df8a3f
iOS: keep a failed recorder alive until its audio queue stops calling back (#2133)
When the keyboard can't dictate itself (keyboardNeedsHex) its Hex key opens
Hex, which records with AVAudioRecorder. If the microphone fails there (no
input in the simulator, or another app holding it), record() returns false
after AudioQueueStart fails, and the recorder stops and disposes its queue
from inside the queue's own callback, asynchronously. beginCapture threw and
freed the recorder right away, while restoreAudioAfterCapture restarted the
keepalive; an input callback the queue had already fetched then read the freed
recorder and Hex crashed (EXC_BAD_ACCESS in objc_loadWeak,
AudioRecorderAQInputCallback, thread AQClient), instead of showing "Hex
couldn't start the microphone".

- RetiredRecorders holds a recorder that failed to start, or that a capture
  stopped, for 5 s before it is freed. Nothing reports when the queue's last
  callback ran; disposal takes about a millisecond in the simulator log.
- beginCapture stops and retires the recorder before throwing; the capture
  adapter retires it on stop (once, so a second stop is a no-op).
- startKeepalive removes its tap and resets the engine when engine.start()
  throws, so a failed start leaves nothing half-installed.

The keyboard's own capture (KeyboardLocalDictation / KeyboardWebCapture)
records through WebKit's getUserMedia and gets its callbacks on the main
thread through WKScriptMessageHandler; it has no audio-thread callback or
weak read like this, so it is unchanged.

Tests (DictationControllerTests): a microphone that fails when the keyboard
opens Hex shows the message in the app and the keyboard, leaves no job,
capture or keepalive behind, and the next Hex key records; a recorder end
arriving after teardown changes nothing; a retired AVAudioRecorder outlives its
owner for the hold and is then freed.

Verified on iOS 27.2 simulators on the Mac Studio (no microphone input):
- Keyboard (keyboardNeedsHex) > Hex key in Messages > Hex: before, 2 crashes
  in 21 runs with this stack; after, 0 crashes in 20 runs (10 cold launches,
  10 warm), Hex alive and showing "Hex couldn't start the microphone. Try
  again." each time.
- In-app Dictate, 5 times: the message each time, same process, no crash.
- An uncommitted stress test of SystemAudioManager's failing start (100 x
  beginCapture then startKeepalive): crashed the test host 2 of 2 before,
  passed 3 of 3 after.
- xcodebuild test: 391 tests, 0 failures (1 skipped).
2026-11-21 03:16:37 +00:00
..
Assets.xcassets feat: add iOS dictation keyboard 2026-07-19 15:21:45 -04:00
zh-Hans.lproj iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
AcknowledgementsView.swift iOS: never suggest slurs, and swear words only when asked (#2093) 2026-11-20 20:17:31 +00:00
AppleSpeechTranscriber.swift iOS: never ask for Speech Recognition, and slides from 123 show the key preview (#2109) 2026-11-20 23:04:26 +00:00
AppShortcuts.xcstrings iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
AudioBackend.swift iOS: keep a failed recorder alive until its audio queue stops calling back (#2133) 2026-11-21 03:16:37 +00:00
ContentView.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
CustomVocabularyEditor.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
DictationController+LaunchFixtures.swift iOS: split DictationController so dev passes the size check (#2066) 2026-11-20 11:42:45 -05:00
DictationController.swift iOS: format dictated lists, and write out gonna and wanna (#2131) 2026-11-21 03:01:16 +00:00
EmojiSemanticIndex.swift iOS: emoji panel with on-device suggestions (Experiments › Emoji) (#2051) 2026-11-20 15:53:24 +00:00
FullKeyboardSnapshotStage.swift iOS: Emoji and Swipe typing are on by default, under Settings › Keyboard (#2129) 2026-11-21 02:41:15 +00:00
HexIntents.swift feat(ios): polish iPhone keyboard dictation, warm sessions, and Live Activity (#574) 2026-10-30 23:35:45 -07:00
HexLinks.swift iOS: privacy and support links in the app, Continue before the mic prompt, typing logs consent (#2063) 2026-11-20 16:23:37 +00:00
HEXMobile.entitlements Set up Hex Mobile internal TestFlight releases (#1997) 2026-11-19 11:48:49 -05:00
HEXMobileApp.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
Info.plist iOS: plain permission prompts and no pre-prompt Allow button, for App Review (#2058) 2026-11-20 16:13:36 +00:00
KeyboardPreviewHost.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
KeyboardSetup.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
LanguageSettingsRows.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
LiveActivityCoordinator.swift iOS: fix six TestFlight tester issues (audio error, leaked error text, Live Activity, haptics, capitals, push to talk) (#2035) 2026-11-20 13:21:16 +00:00
Localizable.xcstrings iOS: format dictated lists, and write out gonna and wanna (#2131) 2026-11-21 03:01:16 +00:00
Onboarding.swift iOS: onboarding's Microphone row asks for the microphone itself (#2092) 2026-11-20 20:10:10 +00:00
OnboardingProgress.swift iOS: add a three-page first-run onboarding (#2031) 2026-11-20 12:36:45 +00:00
ParakeetTranscriber.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
PrivacyInfo.xcprivacy iOS: version 1.0, iPhone only, privacy manifests (#2052) 2026-11-20 15:54:01 +00:00
SettingsComponents.swift iOS: Emoji and Swipe typing are on by default, under Settings › Keyboard (#2129) 2026-11-21 02:41:15 +00:00
SettingsPages.swift iOS: format dictated lists, and write out gonna and wanna (#2131) 2026-11-21 03:01:16 +00:00
TranscriptCleanup.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
TranslateDictationRow.swift iOS: let Translate what I say insert in the language you usually dictate in (#2078) 2026-11-20 17:53:31 +00:00
TypingInsightsView.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
TypingLogsView.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00