iOS Share sheet extension doesn't show my app in the suggested list

119 Views Asked by At

I've added a iOS share extension in my React Native app and it was working and suddenly it has stopped working. Here's how my Info.plist file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
      <key>PHSupportedMediaTypes</key>
         <array>
              <!--TODO: Add this flag, if you want to support sharing video into your app-->
             <string>Video</string>
             <!--TODO: Add this flag, if you want to support sharing images into your app-->
             <string>Image</string>
         </array>
      <key>NSExtensionActivationRule</key>
      <dict>
          <key>NSExtensionActivationSupportsImageWithMaxCount</key>
          <integer>100</integer>
          <key>NSExtensionActivationSupportsFileWithMaxCount</key>
          <integer>100</integer>
      </dict>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>
</dict>
</plist>

My main appgroup and extension appgroup names are same, and the deployment target version is also same for both and appdelegate file is also configured to handle images, but I still can't see my app in the share extension suggestion. can someone please help me solve this?

When I run the share extension from xcode and try share an image file I get this error log:

Failed to request default share mode for fileURL:file:///Users/zerodev/Library/Developer/CoreSimulator/Devices/6F5B70E6-6AE4-43FB-B5BC-82C38DFB35CD/data/Containers/Shared/AppGroup/D2A5F375-D254-49F6-8FD4-D7938B094F67/File%20Provider%20Storage/Downloads/dance-studio-invoice-design/7455237.jpg error:Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=1608, _LSFunction=runEvaluator}

Only support loading options for CKShare and SWY types.

[ERROR] failed to get service endpoint creating for for item at URL file:///Users/zerodev/Library/Developer/CoreSimulator/Devices/6F5B70E6-6AE4-43FB-B5BC-82C38DFB35CD/data/Containers/Shared/AppGroup/D2A5F375-D254-49F6-8FD4-D7938B094F67/File%20Provider%20Storage/Downloads/dance-studio-invoice-design/7455237.jpg: Error Domain=NSCocoaErrorDomain Code=3328 "The requested operation couldn’t be completed because the feature is not supported."


1

There are 1 best solutions below

0
LiteApplication On

If you're using a custom ShareViewController.swift for your Share Extension, ensure it's correctly set up to handle the shared content. This Github Issue seems to have been fixed by replacing the initial ShareViewController.swift with a new one from the node-modules/react-native-share-menu/ios/ShareViewController.swift.

I'm not a swift expert so I'm not sure about that one, but make sure that the <dict> tags are properly nested, because the code you shared contains weird indentation. Here is the properly indented dict:

<dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>PHSupportedMediaTypes</key>
            <array>
                <!--TODO: Add this flag, if you want to support sharing video into your app-->
                <string>Video</string>
                <!--TODO: Add this flag, if you want to support sharing images into your app-->
                <string>Image</string>
            </array>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsImageWithMaxCount</key>
                <integer>100</integer>
                <key>NSExtensionActivationSupportsFileWithMaxCount</key>
                <integer>100</integer>
            </dict>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>
</dict>

I would also suggest that you double-check that the App Group is correctly configured in both your main app and the Share Extension.

Hope this helps :)