7.4 C
New York
Wednesday, December 18, 2024

react native – Easy methods to configure Expo to help sharing a number of pictures (Images) with an iOS app?


I’m constructing an Expo-managed iOS app and want to permit my app to simply accept a number of pictures shared instantly from Apple Images by way of the iOS Share Sheet.

I take advantage of eas construct --platform ios --profile growth to check the app on an actual machine (not by way of the Expo Go app) in order that new options are supported.


Present Conduct:

  • After I share one picture from Apple Images, my app seems within the Share Sheet and works appropriately.
  • Nonetheless, after I choose two or extra pictures, my app disappears from the Share Sheet listing.

Configuration:

Right here’s my app.config.js:

import { ExpoConfig, ConfigContext } from "@expo/config";
import { model } from "./bundle.json";

const IS_DEV = course of.env.APP_VARIANT === "growth";

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  title: IS_DEV ? "Calorily Debug" : "Calorily",
  slug: "calorily",
  model: model,
  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 images to investigate 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.",
      },
    ],
  ],
});

Objective:

  • Guarantee my app can seem within the iOS Share Sheet when choosing a number of pictures (as much as 10).
  • Correctly obtain and course of the shared pictures.

What I’ve Tried:

  1. Including NSExtensionActivationRule to help as much as 10 pictures.
  2. Specifying CFBundleDocumentTypes with "LSSupportsMultipleItems": true.
  3. Confirmed that my app works high-quality when one picture is shared.

Difficulty:

  • My app doesn’t seem within the Share Sheet when choosing two or extra pictures.
  • Is there one thing lacking in my configuration or limitations with Expo for dealing with a number of recordsdata?

Further Particulars:

  • I’m testing with eas construct --platform ios --profile growth (not with the Expo Go app).
  • My app makes use of the Expo Managed Workflow.
  • I’ve hooked up screenshots exhibiting the habits when one picture is shared (app seems) vs. a number of pictures (app disappears).

worksdoesn't work

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles