Th0rgal
Th0rgal

Reputation: 939

How to configure Expo to support sharing multiple images (Photos) with an iOS app?

I’m building an Expo-managed iOS app and need to allow my app to accept multiple images shared directly from Apple Photos via the iOS Share Sheet.

I use eas build --platform ios --profile development to test the app on a real device (not via the Expo Go app) so that new features are supported.


Current Behavior:


Configuration:

Here’s my app.config.js:

import { ExpoConfig, ConfigContext } from "@expo/config";
import { version } from "./package.json";

const IS_DEV = process.env.APP_VARIANT === "development";

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  name: IS_DEV ? "Calorily Debug" : "Calorily",
  slug: "calorily",
  version: version,
  orientation: "portrait",
  ios: {
    bundleIdentifier: "com.calorily.app",
    supportsTablet: true,
    usesAppleSignIn: true,
    infoPlist: {
      CFBundleDocumentTypes: [
        {
          CFBundleTypeName: "Images",
          LSHandlerRank: "Alternate",
          LSItemContentTypes: ["public.image", "public.jpeg", "public.png"],
          CFBundleTypeRole: "Viewer",
          LSSupportsMultipleItems: true,
        },
      ],
      NSExtensionActivationRule: {
        NSExtensionActivationSupportsImageWithMaxCount: 10,
      },
      NSPhotoLibraryUsageDescription:
        "This app accesses your photos to analyze your meals.",
      LSSupportsOpeningDocumentsInPlace: true,
      UISupportsDocumentBrowser: true,
      UTImportedTypeDeclarations: [
        {
          UTTypeIdentifier: "com.calorily.app",
          UTTypeTagSpecification: {
            "public.mime-type": "image/*",
            "public.filename-extension": ["jpg", "jpeg", "png"],
          },
          LSHandlerRank: "Alternate",
          CFBundleTypeRole: "Viewer",
          LSSupportsMultipleItems: true,
        },
      ],
    },
  },
  plugins: [
    [
      "expo-image-picker",
      {
        photosPermission: "This app accesses your photos to analyze your meal.",
        cameraPermission: "This app accesses your camera to analyze your meal.",
      },
    ],
  ],
});

Goal:


What I’ve Tried:

  1. Adding NSExtensionActivationRule to support up to 10 images.
  2. Specifying CFBundleDocumentTypes with "LSSupportsMultipleItems": true.
  3. Confirmed that my app works fine when one image is shared.

Issue:


Additional Details:

worksdoesn't work

Upvotes: 0

Views: 61

Answers (0)

Related Questions