fix: camera crash — add NSCameraUsageDescription + availability check
All checks were successful
Security Checks / dependency-audit (push) Successful in 13s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 4s

Crash: iOS terminates the app when accessing camera without the
privacy description in Info.plist.

Fix:
- Added NSCameraUsageDescription to Info.plist
- "Take Photo" option only shows if camera is available
  (UIImagePickerController.isSourceTypeAvailable(.camera))

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-04 22:40:43 -05:00
parent 6a694fcbcf
commit e28c4d0003
2 changed files with 8 additions and 4 deletions

View File

@@ -87,11 +87,13 @@ struct AssistantChatView: View {
// Input bar // Input bar
HStack(alignment: .bottom, spacing: 10) { HStack(alignment: .bottom, spacing: 10) {
Menu { Menu {
if UIImagePickerController.isSourceTypeAvailable(.camera) {
Button { Button {
showCamera = true showCamera = true
} label: { } label: {
Label("Take Photo", systemImage: "camera") Label("Take Photo", systemImage: "camera")
} }
}
Button { Button {
showPhotoPicker = true showPhotoPicker = true

View File

@@ -6,5 +6,7 @@
<true/> <true/>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>NSCameraUsageDescription</key>
<string>Take a photo of your meal to log it with AI</string>
</dict> </dict>
</plist> </plist>