fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.55k stars 928 forks source link

[Bug]: Couldn't share to Instagram #1916

Closed onguc closed 9 months ago

onguc commented 1 year ago

Platform

ipad 16.3

Plugin

share_plus

Version

7.0.2

Flutter SDK

3.7.12

Steps to reproduce

i get this error when i want to share to instagram on my ipad. (no problem on android) instagram paylaşımı

I also want it to appear like below when posting on Instagram.

IMG_5B14499E8897-1

Does anyone have an idea? Thanks

Code Sample

Share.shareFiles(
          [imagePath],
          subject: product.productName ?? "",
          text: product.productUrl ?? "",
          sharePositionOrigin: positionOrigin(isIpad),
        );

Logs

[+8018 ms] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must
implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3 22E252 darwin-arm64, locale tr-TR)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
[✓] VS Code (version 1.78.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

Checklist before submitting a bug

vijaybheda-bosctech commented 1 year ago

I attempted to share a content and link on Instagram, but encountered an error stating, "Can't send media - Try copying and sending the link instead."

Could someone assist me in sharing text and a link through the Instagram iOS app?

vijaybheda-bosctech commented 1 year ago

I attempted to share a content and link on Instagram, but encountered an error stating, "Can't send media - Try copying and sending the link instead."

Could someone assist me in sharing text and a link through the Instagram iOS app?

I've test with other dependencies but it didn’t work.

https://pub.dev/packages/social_share https://pub.dev/packages/share https://pub.dev/packages/share_plus https://pub.dev/packages/flutter_share_me

nguyenquynh201 commented 1 year ago

have you found the solution yet?

ericdolson commented 1 year ago

Bump! I need this as well. Not being able to share a single image to instagram is a bummer. I would love this to be made available! Thank you :)

tchowski commented 1 year ago

Any update on this?

vbuberen commented 9 months ago

It is not a bug of plugin, but issue artificially created by Meta for their shitty apps.

mohmedelsayed commented 8 months ago

i finally solved this issue .. Issue:

Instagram considers image and text caption as multiple images, preventing successful sharing due to an Instagram issue. The original _shareSheet function was designed to share an image with a text caption. To address the problem, it is recommended to modify the function as follows:

Original Function: _shareSheet(File file) async { try { await Share.shareXFiles([XFile(file.path)], text: "Mohamed El-Sayed"); } catch (error) { return; } }

Modified Function:

_shareSheet(File file) async { try { await Share.shareXFiles([XFile(file.path)], text: null); } catch (error) { return; } }

This change ensures that when sharing an image, no text is included, resolving the issue with Instagram's interpretation.

Additionally, there's a recommendation to update the usage of Share.shareFiles in the code. The original usage: Share.shareFiles( [imagePath], subject: product.productName ?? "", text: product.productUrl ?? "", sharePositionOrigin: positionOrigin(isIpad), ); Should be updated to:

Share.shareFiles( [imagePath], subject: null, text: null, sharePositionOrigin: positionOrigin(isIpad), );

This change aligns with the modified _shareSheet function, ensuring that no text is shared along with the image.

Please review and consider implementing these changes to address the Instagram sharing issue.

Meistro77 commented 2 months ago

i finally solved this issue .. Issue:

Instagram considers image and text caption as multiple images, preventing successful sharing due to an Instagram issue. The original _shareSheet function was designed to share an image with a text caption. To address the problem, it is recommended to modify the function as follows:

Original Function: _shareSheet(File file) async { try { await Share.shareXFiles([XFile(file.path)], text: "Mohamed El-Sayed"); } catch (error) { return; } }

Modified Function:

_shareSheet(File file) async { try { await Share.shareXFiles([XFile(file.path)], text: null); } catch (error) { return; } }

This change ensures that when sharing an image, no text is included, resolving the issue with Instagram's interpretation.

Additionally, there's a recommendation to update the usage of Share.shareFiles in the code. The original usage: Share.shareFiles( [imagePath], subject: product.productName ?? "", text: product.productUrl ?? "", sharePositionOrigin: positionOrigin(isIpad), ); Should be updated to:

Share.shareFiles( [imagePath], subject: null, text: null, sharePositionOrigin: positionOrigin(isIpad), );

This change aligns with the modified _shareSheet function, ensuring that no text is shared along with the image.

Please review and consider implementing these changes to address the Instagram sharing issue.

You available for hire?