Skip to content

Conversation

@alex-pythonista
Copy link
Contributor

@alex-pythonista alex-pythonista commented Jan 16, 2026

Summary

  • Adds expo-image-picker plugin to app.json with iOS permission strings
  • Fixes app crash when accessing camera for receipt scanning
  • Adds reusable image picker utilities with camera availability detection

Fixes #7

Problem

The iOS app crashes immediately when attempting to use the camera in the receipt form component. iOS requires apps to declare usage descriptions for privacy-sensitive features via NSCameraUsageDescription and NSPhotoLibraryUsageDescription keys in Info.plist.

Additionally, camera functionality silently fails on iOS Simulator with no user feedback.

Solution

  1. Added the expo-image-picker plugin configuration to app.json with appropriate permission messages:
[
  "expo-image-picker",
  {
    "photosPermission": "Allow $(PRODUCT_NAME) to access your photos to upload receipt images for transaction extraction.",
    "cameraPermission": "Allow $(PRODUCT_NAME) to access your camera to take photos of receipts for transaction extraction."
  }
]
  1. Created reusable utils/imagePicker.ts with:

    • launchCamera() - Camera capture with availability check and permissions
    • launchImageLibrary() - Gallery picker with permissions
    • checkCameraAvailability() - Standalone availability check
    • User-friendly alert when camera is unavailable (e.g., iOS Simulator)
  2. Refactored receipt-form.tsx to use the new utilities

Test plan

  • Run npx expo prebuild --clean to regenerate native projects
  • Run npx expo run:ios to build and launch on iOS
  • Navigate to receipt form and tap camera button
  • Verify iOS shows permission dialog with configured message
  • Verify camera launches successfully after granting permission (physical device)
  • Verify helpful alert appears on iOS Simulator when tapping camera
  • Verify photo library picker works correctly

🤖 Generated with Claude Code

Fixes ASHWIN776#7 - iOS app crashes when accessing camera due to missing
NSCameraUsageDescription in Info.plist.

Added expo-image-picker plugin configuration with appropriate permission
strings for camera and photo library access, enabling the receipt
scanning feature to work properly on iOS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@alex-pythonista
Copy link
Contributor Author

Code Review: PR #9

Overview

This PR adds the expo-image-picker plugin configuration to app.json to fix the iOS camera crash caused by missing NSCameraUsageDescription in Info.plist.

Analysis

✅ Correctness

  • The fix correctly addresses the root cause (missing iOS permission declarations)
  • Plugin configuration follows Expo's official documentation
  • Both cameraPermission and photosPermission are included, covering both camera and photo library access used in components/receipt-form.tsx

✅ Code Quality

  • Minimal, focused change (+8/-1 lines)
  • Proper JSON formatting maintained
  • Permission strings are user-friendly and explain the specific use case (receipt scanning)

✅ Conventions

  • Uses $(PRODUCT_NAME) Xcode variable as per Apple/Expo best practices
  • Plugin placement at the end of the plugins array is appropriate

✅ Security

  • Permission strings follow Apple's privacy guidelines by explaining why access is needed
  • No over-permissioning (microphonePermission not included since it's not needed)

Suggestions

None - this is a clean, correct fix.

Verdict

LGTM

The change is minimal, correct, and follows best practices. After merging, remember to run:

npx expo prebuild --clean
npx expo run:ios

🤖 Reviewed by Claude Code

Extract image picker logic into utils/imagePicker.ts for reusability.
Shows user-friendly alert when camera is unavailable (e.g., iOS Simulator)
instead of silently failing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@alex-pythonista
Copy link
Contributor Author

Permission preview

image

Camera Not Available

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: Missing NSCameraUsageDescription causes app crash when using camera

1 participant