返回顶部
i

ios-keyboard-limitations

iOS keyboard extension technical limitations and workarounds. Use when planning or building iOS custom keyboards with voice/audio features, dictation, or system integration needs. Covers memory limits, sandbox restrictions, microphone access, app launching, and viable alternative architectures.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
953
下载量
0
收藏
概述
安装方式
版本历史

ios-keyboard-limitations

# iOS Keyboard Extension Limitations When building iOS custom keyboards with voice/audio features, these are the hard limitations discovered through the PolyVoice project. ## 🔴 Hard Limitations (Cannot be worked around) ### 1. Microphone Access — DISALLOWED **Keyboard extensions cannot access the microphone.** - `AVAudioRecorder` will fail with permission error - `SFSpeechRecognizer` is unavailable - No Siri integration from keyboard context **Why:** Apple security model — keyboards run in sandbox and could keylog audio. ### 2. Open Other Apps — BLOCKED **Keyboards cannot programmatically open the main app or any other app.** - `UIApplication.shared.open()` returns false - URL schemes don't work (`myapp://`) - ` ExtensionContext.open()` not available **Why:** Prevents malicious keyboards from launching apps without user consent. ### 3. Memory Limit — ~50MB **Keyboard extensions have strict memory limits (~30-60MB).** - App terminated silently if exceeded - No crash log, just disappears - Heavy audio processing = instant death **Mitigation:** - Record at 16kHz mono (not 44.1kHz) - Use 32kbps bitrate max - Immediate file cleanup after processing - 60-second max recording hard limit ### 4. No Persistent Storage **UserDefaults unavailable, only App Groups.** - Standard `UserDefaults` doesn't persist - Must use `UserDefaults(suiteName: "group.com.company.app")` - Requires App Group capability in both targets ### 5. Network Requires "Full Access" **API calls fail without user enabling "Allow Full Access" in Settings.** - User must explicitly enable: Settings → General → Keyboard → [Keyboard Name] → Allow Full Access - Most users won't do this - Cannot prompt or explain from keyboard UI effectively ## 🟡 Partial Workarounds (User friction) ### The "Open App" Workaround **Goal:** Let user tap a button to open main app for recording. **Attempt:** ```swift // This does NOT work extensionContext?.open(URL(string: "myapp://record")!) ``` **Reality:** Must use `UIApplication.shared.open()` outside extension context, but keyboards can't call this. ### The Manual Switch Pattern **What actually works (with friction):** 1. **User taps button in keyboard** → Shows alert: "Open PolyVoice to record?" 2. **User manually switches to main app** (Home button, swipe, etc.) 3. **Main app detects active session** (via App Groups / shared state) 4. **Main app auto-records** on appear 5. **Auto-stops on silence** (2 seconds) 6. **Auto-copies** to clipboard 7. **User manually switches back** to target app 8. **Keyboard auto-pastes** on reappear **User flow:** ``` Keyboard → Tap mic → [Manual: Switch to app] → App auto-records → [Manual: Switch back] → Keyboard auto-pastes ``` **Friction points:** - Two manual app switches - Context switching breaks flow - Users forget to return - Clipboard may be overwritten ## 🟢 Alternative Architectures ### Option 1: Share Extension (Better for Audio) **Use Share Sheet instead of keyboard.** - Full app capabilities - Can record audio - Can process and return text **Limitation:** Not a keyboard — user must open share sheet per text field. ### Option 2: Full App Mode **Don't use keyboard extension — use main app only.** - User opens app - Records dictation - Copies result - Switches to target app - Pastes manually **Benefit:** No memory limits, full mic access, reliable. **Cost:** More friction than keyboard. ### Option 3: Siri Shortcuts Integration **Provide Siri Shortcuts for voice-to-text.** - "Hey Siri, dictate with PolyVoice" - Returns text to current app - Fully supported by Apple **Limitation:** Not instant, requires Siri setup. ## 📊 Decision Matrix | Approach | Mic Access | Memory | User Friction | Apple Approved | |----------|-----------|---------|---------------|----------------| | Keyboard extension | ❌ No | ⚠️ 50MB | Low (if no audio) | ✅ Yes | | Keyboard + audio workaround | ❌ No | ⚠️ 50MB | 🔴 High | ✅ Yes | | Share extension | ✅ Yes | ✅ Full | 🟡 Medium | ✅ Yes | | Full app only | ✅ Yes | ✅ Full | 🟡 Medium | ✅ Yes | | Siri Shortcuts | ✅ Yes | ✅ Full | 🟡 Medium | ✅ Yes | ## 🎯 Recommendation **For voice dictation/AI transcription:** 1. **Don't build a keyboard extension** — the limitations make it frustrating 2. **Use Share Extension** — Apple-supported, full capabilities 3. **Or full app** — simplest to build, most reliable 4. **Add Shortcuts** — for power users who want speed **For non-audio keyboards (emoji, translation, etc.):** Keyboard extension works great. Just avoid audio features. ## 📚 References - Apple's official docs: https://developer.apple.com/documentation/uikit/keyboards_and_input/creating_a_custom_keyboard - Custom Keyboard Programming Guide (WWDC sessions) - PolyVoice project learnings (~/Projects/polyvoice-keyboard/)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ios-keyboard-limitations-1776420060 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ios-keyboard-limitations-1776420060 技能

通过命令行安装

skillhub install ios-keyboard-limitations-1776420060

下载 Zip 包

⬇ 下载 ios-keyboard-limitations v1.0.0

文件大小: 3.03 KB | 发布时间: 2026-4-17 19:46

v1.0.0 最新 2026-4-17 19:46
- Initial release summarizing hard technical limitations of iOS custom keyboards, focused on audio/voice features.
- Details restrictions: microphone access, app launching, memory limits, storage, and networking requirements.
- Documents partial workarounds and friction-heavy patterns for integrating voice features.
- Compares alternative architectures: share extension, standalone app, and Siri Shortcuts.
- Provides a decision matrix and clear recommendations for different use cases.
- Includes reference links to Apple documentation and PolyVoice project insights.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部