ShoutSocial / share_handler

A plugin to facilitate receiving and handling share intents
41 stars 39 forks source link

IOS on clicking app from share sheet not opening the app just the zoom out animation #63

Open amalshyjo opened 1 year ago

amalshyjo commented 1 year ago

So the app is showing in the share sheet but on clicking it does not lead to the app this is working perfectly on android. This behaviour is same for text and image. i am not a IOS developer

https://github.com/ShoutSocial/share_handler/assets/56060390/478da718-07f2-4e91-bcb1-05670d1b939e

Screenshot 2023-07-27 at 6 04 14 PM Screenshot 2023-07-27 at 6 04 08 PM

My code i have followed the readme info.plist

...
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
                </array>
            </dict>
        </array>
....
        <key>NSPhotoLibraryUsageDescription</key>
        <string>This app uses file storage for debug purpose</string>
...

Pubspec.yaml share_handler: ^0.0.17

ShareExtension.entitlements

<?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>com.apple.security.application-groups</key>
    <array>
        <string>group.###</string>
    </array>
</dict>
</plist>

Podfile

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # Add this block
  target 'ShareExtension' do
    inherit! :search_paths
    pod "share_handler_ios_models", :path => ".symlinks/plugins/share_handler_ios/ios/Models"
  end
  # End of block

end

ShareExtension > Info.plist

<?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>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>NSExtension</key>
    <dict>
      <key>NSExtensionAttributes</key>
      <dict>
        <key>IntentsSupported</key>
        <array>
          <string>INSendMessageIntent</string>
        </array>
        <key>NSExtensionActivationRule</key>
        <dict>
          <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsImageWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsFileWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsText</key>
          <true />
        </dict>
        <key>PHSupportedMediaTypes</key>
        <array>
          <string>Image</string>
        </array>
      </dict>
      <key>NSExtensionMainStoryboard</key>
      <string>MainInterface</string>
      <key>NSExtensionPointIdentifier</key>
      <string>com.apple.share-services</string>
    </dict>
  </dict>
</plist>
<img width="700" alt="Screenshot 2023-07-27 at 6 04 08 PM" src="https://github.com/ShoutSocial/share_handler/assets/56060390/433d2a56-d8dc-46e7-a3e8-2f1ca85bea4b">

ShareViewController class ShareViewController: ShareHandlerIosViewController {}

jamescardona11 commented 1 year ago

Are you using a custom group?

amalshyjo commented 1 year ago

Are you using a custom group?

No, i haven't used custom group i also used the following package - https://pub.dev/packages/receive_sharing_intent the result are the same

jamescardona11 commented 1 year ago

@amalshyjo Sorry, I tested different ways and can't replicate it. I hope you can fix it.

ShaggyGettu commented 1 year ago

Hi @amalshyjo, having the same problem, are you maybe using different Bundle Identifier for every environment?

gekosurf commented 1 year ago

Have you added the group in your develop account settings? It needs to be enabled for the bundle. Also the share _intent needs a bundle name with an extension id of some sort:

amalshyjo commented 1 year ago

sorry for the late reply, @ShaggyGettu no its a single bundle identifier for every environment @gekosurf i didn't full get what i should could you explain it more, as i do not have much idea about IOS development

mny459 commented 1 year ago
<key>AppGroupId</key>
<string>group.myGroupId</string>

I had same problem. And I fix this by add top code to both Runner and ShareExtension Info.plist

amalshyjo commented 1 year ago
<key>AppGroupId</key>
<string>group.myGroupId</string>

I had same problem. And I fix this by add top code to both Runner and ShareExtension Info.plist

oh so create group id and connect to the app right, wait is this a custom group id @mny459

mny459 commented 1 year ago
<key>AppGroupId</key>
<string>group.myGroupId</string>

I had same problem. And I fix this by add top code to both Runner and ShareExtension Info.plist

oh so create group id and connect to the app right, wait is this a custom group id @mny459

I am not sure which is custom or default group id. I am not a iOS developer. But I could tell you is I just replase <string>$(CUSTOM_GROUP_ID)</string> to my real group id, then everything works.

MuhammedRefaat commented 1 year ago

@ShaggyGettu I'm using a bundle identifier for each environment, any clue?

amalshyjo commented 1 year ago
<key>AppGroupId</key>
<string>group.myGroupId</string>

I had same problem. And I fix this by add top code to both Runner and ShareExtension Info.plist

oh so create group id and connect to the app right, wait is this a custom group id @mny459

I am not sure which is custom or default group id. I am not a iOS developer. But I could tell you is I just replase <string>$(CUSTOM_GROUP_ID)</string> to my real group id, then everything works.

hey, tried and its still the same result, so the there is a zoom out animation and then then nothing there is not popup or anything.

amalshyjo commented 1 year ago

Are you using a custom group?

Currently trying to do using custom group id to check if that would work.

Rishab-ms commented 10 months ago

@amalshyjo did it work?

udiedrichsen commented 10 months ago

Not for me, I have a custom group.

The-Nils commented 10 months ago

nothing work for me for both custom and default group

juanan-onelife commented 9 months ago

hi! i have the same issue when the app is killed, i share the content and the splash screen flash and closed. Could anyone fix it?

Edit: I'm testing on physical device

jasperbel commented 9 months ago

I had the same problem on the simulater, but on a device it works.

Edit: could also be related to the iOS version (of the simulator?). I see @amalshyjo is using 16.2 in his sim, I was using the same.

jsiedentop commented 9 months ago

I had the same problem. I discovered that the Minimum Deployments for the ShareExtension was set to iOS 17.0. After I reduced it to iOS 14.0, it worked.

In Xcode: Targets -> ShareExtension -> General -> Minimum Deployments -> iOS 14.0.

I hope it helps.

udiedrichsen commented 9 months ago

I had the same problem. I discovered that the Minimum Deployments for the ShareExtension was set to iOS 17.0. After I reduced it to iOS 14.0, it worked.

In Xcode: Targets -> ShareExtension -> General -> Minimum Deployments -> iOS 14.0.

I hope it helps.

Cool, this works for me on a real device but not on a simulator.

842787863 commented 8 months ago
<key>AppGroupId</key>
<string>group.myGroupId</string>

我有同样的问题。我通过向 Runner 和 ShareExtension Info.plist 添加顶级代码来解决此问题

Thanks, although I am not a custom group, this method helped me solve the problem