react-native-share: Share.shareSingle() throws unhandled promise rejection only on ios

Hi. this library is working fine on all cases on android but i am running into few issues on ios. My implementation of this lib is with a custom view component with icons when clicked will initiate the sharing process.

Environment:

"react": "16.2.0",
"react-native": "^0.53.3"
"react-native-share": "^1.0.27"

Using share as: import Share from 'react-native-share';

I have a facebook icon when pressed calls:

this.props.setTimeout(() => { Share.shareSingle({ ...this.state.shareOptions, social: 'facebook' }) }, 50);

Android produces desired behaviour however on ios i get the warning below.

Possible Unhandled Promise Rejection (id: 0):
Object {
  "error": Object {
    "code": "ECOM.RNSHARE1",
    "domain": "com.rnshare",
    "message": "The operation couldn’t be completed. Not installed",
    "nativeStackIOS": Array [
      "0   TestApp                          0x000000010ff94b26 RCTJSErrorFromCodeMessageAndNSError + 134",
      "1   TestApp                          0x000000010ff94a53 RCTJSErrorFromNSError + 275",
      "2   TestApp                          0x000000010ff25058 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.187 + 152",
      "3   TestApp                          0x000000010fe93c8d -[GenericShare shareSingle:failureCallback:successCallback:serviceType:] + 2301",
      "4   TestApp                          0x000000010fe91f75 -[RNShare shareSingle:failureCallback:successCallback:] + 373",
      "5   CoreFoundation                      0x0000000119118ccc __invoking___ + 140",
      "6   CoreFoundation                      0x0000000119118b84 -[NSInvocation invoke] + 308",
      "7   CoreFoundation                      0x00000001191318d6 -[NSInvocation invokeWithTarget:] + 54",
      "8   Battledore                          0x000000010ff2803c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796",
      "9   TestApp                          0x000000010ffdc012 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786",
      "10  TestApp                          0x000000010ffdbb3f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127",
      "11  TestApp                          0x000000010ffdbab9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25",
      "12  libdispatch.dylib                   0x0000000119f3773b _dispatch_call_block_and_release + 12",
      "13  libdispatch.dylib                   0x0000000119f38779 _dispatch_client_callout + 8",
      "14  libdispatch.dylib                   0x0000000119f42778 _dispatch_main_queue_callback_4CF + 1279",
      "15  CoreFoundation                      0x0000000119157c99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9",
      "16  CoreFoundation                      0x000000011911bea6 __CFRunLoopRun + 2342",
      "17  CoreFoundation                      0x000000011911b30b CFRunLoopRunSpecific + 635",
      "18  GraphicsServices                    0x000000011cf3ea73 GSEventRunModal + 62",
      "19  UIKit                               0x0000000114f6f0b7 UIApplicationMain + 159",
      "20  TestApp                          0x000000010fe9195f main + 111",
      "21  libdyld.dylib                       0x0000000113b5a955 start + 1",
    ],
    "userInfo": Object {
      "NSLocalizedFailureReason": "Not installed",
    },
  },
}

When i share it through whatsapp on ios, it takes me to the apple store and on pressing back to return to my app i get an error.

screen shot 2018-05-22 at 13 13 00

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 48 (6 by maintainers)

Most upvoted comments

I’ve same issue on iOS Simulator. It’s should be fixed like this:

Share.shareSingle(shareOptions).catch((err) => { err && console.log(err); });

Don’t just CC me. Do the work: instrument the code, find the problem, post a PR

@chathura88 Thanks for helping here. Really appreciate it.

I followed the installation carefully and completed it with no issues.

1.) npm i react-native-share --save 2.) cd ios && pod install

I am using Xcode 12.4, and I have iOS 14.4.2 installed on my iPhone XS Max.

Here’s my info.plist:

  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>whatsapp</string>
    <string>facebook-stories</string>
    <string>facebookstories</string>
    <string>facebook</string>
    <string>instagram-stories</string>
    <string>instagramstories</string>
    <string>instagram</string>
  </array>

@smaelbarry I’m on the same RN version (0.63.4). this is my current info.plist please check if you have followed all the steps in https://react-native-share.github.io/react-native-share/docs/install

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>tg</string>
  <string>capcut</string>
  <string>lark</string>
  <string>viber</string>
  <string>fbapi</string>
  <string>fb-messenger-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
  <string>kakao61f447fe9723aa9c0b67a52eeb998e77</string>
  <string>kakaokompassauth</string>
  <string>storykompassauth</string>
  <string>kakaolink</string>
  <string>kakaotalk-5.9.7</string>
  <string>storylink</string>
  <string>line</string>
  <string>instagram</string>
  <string>instagram-stories</string>
  <string>lineauth</string>
  <string>line3rdp.com.zhiliaoapp.musically</string>
  <string>whatsapp</string>
  <string>fb-messenger-platform-20150714</string>
  <string>fb-messenger-platform-20150305</string>
  <string>fb-messenger-platform-20150218</string>
  <string>fb-messenger-platform-20150128</string>
  <string>zalo</string>
  <string>snapchat</string>
  <string>twitter</string>
  <string>twitterauth</string>
  <string>bandapp</string>
  <string>kakaostory</string>
  <string>navercafe</string>
  <string>naverblog</string>
  <string>vkauthorize</string>
  <string>vk</string>
  <string>vk-share</string>
  <string>fb</string>
  <string>fb-messenger-share-api</string>
  <string>fb-messenger</string>
  <string>itms-beta</string>
  <string>heloiossso</string>
  <string>comgooglemaps</string>
  <string>resso</string>
</array>

So whatsapp is not installed.

but it is installed. I was running debugger on the physical device. Instead of opening whatsapp it opened App Store with whatsapp

SCREENSHOT OF THE ERROR IMG_1771

Understandably. I guess that solves the issue then. Thanks so much!

Don’t just CC me. Do the work: instrument the code, find the problem, post a PR

I was just asking if you have any news after 9 months, as the issue is closed

hard to say that’s a snippet out of context. But I’d put anything “await” inside a try, with a catch and log the error, just like the comment above you.

@mikehardy yes, I’ve logged that. it was inside trycatch and that’s what I see Screen Shot 2020-06-21 at 5 58 30 PM

@jgcmarins Appologies for replying this late. I have been struglling with this issue till date

BELLOW IS MY REACT-NATIVE DETAILS react-native-cli: 2.0.1 react-native: 0.57.5 “react-native-share”: “^1.1.3”