SingleShare WhatsApp on iOS not working

See original GitHub issue

Steps to reproduce

import Share from 'react-native-share';

const shareOptions = {
    title: 'Share via',
    message: 'some message',
    social: Share.Social.WHATSAPP,
};
Share.shareSingle(shareOptions);

Expected behaviour

It should open the WhatsApp

Actual behaviour

App Crashes

Environment

  • React Native version: 0.59.2
  • React Native platform + platform version: iOS 12.3.1

react-native-share

Version: 1.1.3

RCTFatalException: Exception '*** -[__NSCFConstantString stringByAppendingString:]: nil argument' was thrown while invoking shareSingle on target RNShare with params (
        {
        message = "Hey! I\U2019m really exited to share the new app for stu...: 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
iRyusacommented, Feb 4, 2020

Well it’s installed, that’s the issue… Opening via Linking.openURL('whatsapp://send?text=‘hello from RN’) works just fine.

On Thu, Oct 24, 2019 at 1:17 AM João Marins notifications@github.com wrote:

AppStore is opened when the app is not installed

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-share/issues/555?email_source=notifications&email_token=AAELHTNMBAWJBADY7ZJXJBDQQDLRPA5CNFSM4IG4Y7J2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECDFRAY#issuecomment-545675395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAELHTMWPXI7KJ7Y5XDQFZLQQDLRPANCNFSM4IG4Y7JQ .

3reactions
MateusAndradecommented, Sep 6, 2019

Hi @imbudhiraja , i got a similar problem a time ago, and as i remember is was related to a specific param that WhatsApp on IOS doesn’t recognize. I ended using something similar to this:

export const shareImage = async (image, message, title, subject) => {
  const shareInfo = {
    title,
    url: image,
    subject,
  };

  const shareResponse = ShareCustom.open(shareInfo)
    .then(res => ({ error: '', payload: res, success: true }))
    .catch(err => ({ error: (err && err.error) || 'User did not share', payload: {}, success: false }));

  return shareResponse;
};

I think you can omit the url param without any problem on your case. Btw, let me know if this helps you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SingleShare WhatsApp on iOS not working · Issue #555 - GitHub
Steps to reproduce import Share from 'react-native-share'; const shareOptions = { title: 'Share via', message: 'some message', social: Share ...
Read more >
shareSingle from react-native-share does not work for ...
let shareOptions = { title: 'Share via WhatsApp', message: 'Hey Check out this product', type: 'image/jpeg', url: urlString, filename: ' ...
Read more >
Can't connect to WhatsApp | WhatsApp Help Center
Most connection issues can be resolved by doing one or more of the following: ... Update WhatsApp to the latest version available from...
Read more >
Share.shareSingle | React Native Share - GitHub Pages
The shareSingle() method allows a user to share a premade message via a single prechosen social medium. In other words, code specifies both...
Read more >
Sharing content in React Native apps using React Native Share
The problem with the share package from React Native is that it's ... the singleShare method, else we alert the user that WhatsApp...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found