ShekarMudaliyar / social_share

Flutter package to share images/videos/text on social media
https://pub.dev/packages/social_share
MIT License
112 stars 188 forks source link

Twitter post issue #102

Open roberto701 opened 2 years ago

roberto701 commented 2 years ago

I can't post image to twitter. It seems this library doesn't support yet. How can I solve it?

MATTYGILO commented 2 years ago

Same problem

juanagu commented 2 years ago

I can't share a simple text on iOS, is working fine on Android. I also tried without hashtags same issue.

My code:

  await SocialShare.shareTwitter(
      captionText,
      hashtags: defaultHashtags,
     );

Info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fb-messenger-share-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
        <string>https</string>
        <string>http</string>
        <string>mailto</string>
        <string>instagram-stories</string>
        <string>facebook</string>
        <string>facebook-stories</string>
        <string>instagram</string>
        <string>instagram-stories</string>
        <string>twitter</string>
        <string>whatsapp</string>
    </array>
CallMeIrving commented 2 years ago

@juanagu me too,It just returns the data, but it doesn't open the Twitter app on ios. Android is ok.

DennisAshford commented 2 years ago

Mine also will not open the Twitter app.

Tetsukick commented 2 years ago

me too...

juanagu commented 2 years ago

@juanagu me too,It just returns the data, but it doesn't open the Twitter app on ios. Android is ok.

I made this workaround for iOS:

final hashtags = defaultHashtags.join(' #');

final message = '$captionText \n #$hashtags';
await urlLauncherHelper.openUrl(
    'twitter://post?'
    'message=${Uri.encodeComponent(message)}',
);

If you want to use the plugin for Android and add the workaround for iOS this is the code:


if (Platform.isAndroid) {
    await SocialShare.shareTwitter(
        captionText,
        hashtags: defaultHashtags,
    );
} else {
    final hashtags = defaultHashtags.join(' #');

    final message = '$captionText \n #$hashtags';
    await urlLauncherHelper.openUrl(
        'twitter://post?'
        'message=${Uri.encodeComponent(message)}',
    );
}
felipecastrosales commented 1 year ago
fb-messenger-share-api

can you share in messenger? I need make this.