ShekarMudaliyar / social_share

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

iOS crash also with the #66 workaround #84

Closed Sabatin closed 3 years ago

Sabatin commented 3 years ago

Hi everyone! I've seen how to get around the sudden crash on iOS devices when trying to share a story on Instagram, in the #66 issue (ty @jkronlachner). But, on my physical iPhone 11, the application still crashes. And i don't know how to fix it. Thanks in advance for the support.

I added this in my pubspec.yaml

social_share: 
    git: 
      url: https://github.com/ShekarMudaliyar/social_share.git #^2.1.1

And I added this in my Info.plist file (following the installation guide)

<key>LSApplicationQueriesSchemes</key>
        <array>
            <string>instagram-stories</string>
            <string>facebook-stories</string>
            <string>facebook</string>
            <string>instagram</string>
            <string>twitter</string>
            <string>whatsapp</string>
            <string>tg</string>
        </array>

Last but not least, i am sharing on instagram in this way (using the screenshot plugin):

  final directory = await getApplicationDocumentsDirectory();
  final imagePath = await File('${directory.path}/image.png').create();
  await imagePath.writeAsBytes(image);

   /// Share Plugin
   SocialShare.shareInstagramStory(imagePath.path).then((data) => print(data));

Also tried something like this (because i see something related to use a BG image to fix the error):

SocialShare.shareInstagramStory(imagePath.path,
                  backgroundImagePath: path.storyBG)
              .then((data) => print(data));    

This is the error i get in the console on click on the share button

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x18ed0e708 0x1a38187a8 0x18ed809c8 0x18ed8ca20 0x18ebfb4c0 0x18ebedde0 0x10703c1a4 0x107950694 0x1070f0038 0x1073ef41c 0x10738e81c 0x107390ed4 0x18ec891d4 0x18ec88dd0 0x18ec88220 0x18ec81fd4 0x18ec81308 0x1a6304734 0x1916ff75c 0x191704fcc 0x102ba8f70 0x18e93dcf8)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001bcef9334 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1bcef9334 <+8>:  b.lo   0x1bcef9354               ; <+40>
    0x1bcef9338 <+12>: pacibsp
    0x1bcef933c <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1bcef9340 <+20>: mov    x29, sp
Sabatin commented 3 years ago

Solved using the 2.1.0 version and not the 2.1.1

btbishop93 commented 3 years ago

Solved using the 2.1.0 version and not the 2.1.1

This is still happening on 2.1.0...

DennisAshford commented 2 years ago

I am also having this same issue and not sure how to fix it. This is clearly an issue many people are having, but it isn't clear if there has been a solution?

cs-hyunseo commented 1 year ago

Still no solution?