New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share.shareSingle() throws unhandled promise rejection only on ios #271

Open
softCompound opened this Issue May 22, 2018 · 16 comments

Comments

Projects
None yet
9 participants
@softCompound

softCompound commented May 22, 2018

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

@jgcmarins

This comment has been minimized.

Show comment
Hide comment
@jgcmarins

jgcmarins May 23, 2018

Collaborator

@softCompound did you solve?

Collaborator

jgcmarins commented May 23, 2018

@softCompound did you solve?

@softCompound

This comment has been minimized.

Show comment
Hide comment
@softCompound

softCompound May 23, 2018

Hey @jgcmarins, No i did not find a fix for it. So, the shareSingle funciton apparently return a promise which i can use to gracefully handle the errors but still when i try to share it through facebook or whatsapp by altering the social property of the shareOptions, i am getting nowhere. Those apps are not installed on the simulator so, it takes me to the itunes store and i assume that is the intended behaviour but when i press back to return to my app, i get the red screen with error logs.

softCompound commented May 23, 2018

Hey @jgcmarins, No i did not find a fix for it. So, the shareSingle funciton apparently return a promise which i can use to gracefully handle the errors but still when i try to share it through facebook or whatsapp by altering the social property of the shareOptions, i am getting nowhere. Those apps are not installed on the simulator so, it takes me to the itunes store and i assume that is the intended behaviour but when i press back to return to my app, i get the red screen with error logs.

@jgcmarins

This comment has been minimized.

Show comment
Hide comment
@jgcmarins

jgcmarins May 23, 2018

Collaborator

@softCompound thanks.
I'll reopen so we can keep track of this behaviour.

Collaborator

jgcmarins commented May 23, 2018

@softCompound thanks.
I'll reopen so we can keep track of this behaviour.

@jgcmarins jgcmarins reopened this May 23, 2018

@hpelitebook745G2

This comment has been minimized.

Show comment
Hide comment
@hpelitebook745G2

hpelitebook745G2 Jun 6, 2018

I also got this from choosing Facebook and going back to my app using simulator in iOS.

screen shot 2018-06-06 at 2 02 39 pm

hpelitebook745G2 commented Jun 6, 2018

I also got this from choosing Facebook and going back to my app using simulator in iOS.

screen shot 2018-06-06 at 2 02 39 pm

@enieber enieber added the os: ios label Jun 19, 2018

@phillmill

This comment has been minimized.

Show comment
Hide comment
@phillmill

phillmill Jun 27, 2018

I'm also getting the same result as hpelitebook, but I am using a device that does have facebook installed.

Also, instead of opening the facebook app, it goes to facebook.com in a browser.

phillmill commented Jun 27, 2018

I'm also getting the same result as hpelitebook, but I am using a device that does have facebook installed.

Also, instead of opening the facebook app, it goes to facebook.com in a browser.

@jgcmarins

This comment has been minimized.

Show comment
Hide comment
@jgcmarins
Collaborator

jgcmarins commented Jun 27, 2018

@phillmill

This comment has been minimized.

Show comment
Hide comment
@phillmill

phillmill Jul 6, 2018

If this is of any help on this issue. This is the code I use to share a base64 image to facebook:

[This is iOS]

Share.shareSingle({
	title: 'Test',
	social: Share.Social.FACEBOOK,
	url: 'data:image/jpeg;base64,' + image
})

Expected behaviour is the native facebook post dialog.

Actual behaviour is an attempt to share on facebook.com in a web browser, along with a warning/error message thrown:

screen shot 2018-07-05 at 9 22 32 pm

phillmill commented Jul 6, 2018

If this is of any help on this issue. This is the code I use to share a base64 image to facebook:

[This is iOS]

Share.shareSingle({
	title: 'Test',
	social: Share.Social.FACEBOOK,
	url: 'data:image/jpeg;base64,' + image
})

Expected behaviour is the native facebook post dialog.

Actual behaviour is an attempt to share on facebook.com in a web browser, along with a warning/error message thrown:

screen shot 2018-07-05 at 9 22 32 pm

@jgcmarins

This comment has been minimized.

Show comment
Hide comment
@jgcmarins

jgcmarins Jul 6, 2018

Collaborator

It seems that your link is wrong, could you try on master branch?

Collaborator

jgcmarins commented Jul 6, 2018

It seems that your link is wrong, could you try on master branch?

@phillmill

This comment has been minimized.

Show comment
Hide comment
@phillmill

phillmill Jul 6, 2018

I deleted react-native-share altogether, then re-installed via master branch and I'm getting the same result. I've also tried manual linking and react-native link.

Currently trying a fresh react-native project to see if I can replicate there

phillmill commented Jul 6, 2018

I deleted react-native-share altogether, then re-installed via master branch and I'm getting the same result. I've also tried manual linking and react-native link.

Currently trying a fresh react-native project to see if I can replicate there

@jgcmarins jgcmarins added the bug label Jul 6, 2018

@mbret

This comment has been minimized.

Show comment
Hide comment
@mbret

mbret Jul 18, 2018

I have the exact same probleme with Twitter and facebook. The sharesingle open the twitter app and everything seems right but I get the promise rejection with that error. It does not open facebook but only web browser.

mbret commented Jul 18, 2018

I have the exact same probleme with Twitter and facebook. The sharesingle open the twitter app and everything seems right but I get the promise rejection with that error. It does not open facebook but only web browser.

@keithics

This comment has been minimized.

Show comment
Hide comment
@keithics

keithics Aug 1, 2018

up.. im having the same problem.

keithics commented Aug 1, 2018

up.. im having the same problem.

@jgcmarins

This comment has been minimized.

Show comment
Hide comment
@jgcmarins

jgcmarins Aug 1, 2018

Collaborator

can anyone try master branch?
any repo to reproduce?

Collaborator

jgcmarins commented Aug 1, 2018

can anyone try master branch?
any repo to reproduce?

@thanhcuong1990

This comment has been minimized.

Show comment
Hide comment
@thanhcuong1990

thanhcuong1990 Oct 2, 2018

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

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

thanhcuong1990 commented Oct 2, 2018

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

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

@jgcmarins jgcmarins removed the bug label Oct 2, 2018

@nihp

This comment has been minimized.

Show comment
Hide comment
@nihp

nihp Oct 3, 2018

@thanhcuong1990 I am trying to install apps(Wapp, Instagram, facebook) in iOS Simulator. How can we install this apps.

nihp commented Oct 3, 2018

@thanhcuong1990 I am trying to install apps(Wapp, Instagram, facebook) in iOS Simulator. How can we install this apps.

@thanhcuong1990

This comment has been minimized.

Show comment
Hide comment
@thanhcuong1990

thanhcuong1990 Oct 3, 2018

@nihp You should install the apps in your device. We cannot do that on iOS Simulator.

thanhcuong1990 commented Oct 3, 2018

@nihp You should install the apps in your device. We cannot do that on iOS Simulator.

@nihp

This comment has been minimized.

Show comment
Hide comment
@nihp

nihp Oct 9, 2018

@thanhcuong1990 Thanks. I have installed the app in real device.

nihp commented Oct 9, 2018

@thanhcuong1990 Thanks. I have installed the app in real device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment