facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 909 forks source link

Unable to share photo using ShareDialog in iOS #766

Closed ayush-shta closed 4 years ago

ayush-shta commented 4 years ago

🐛 Bug Report

I can't seem to share photos with ShareDialog in iOS. Sharing links however is working normally.

To Reproduce

I tried to use the share photo feature using ShareDialog but cannot seem to work in iOS.

iOS Error Message: "SharingContent is invalid" Android: Working normally on Android

Using react-native-fbsdk version 1.1.2

Code Example

const sharePhotoContent = {
      contentType : 'photo',
      photos: [{ imageUrl: '[ImagePath]' }],
    }

  ShareDialog.canShow(sharePhotoContent).then(
    (canShow) => {
      if (canShow) {
        return ShareDialog.show(sharePhotoContent);
      }
    }).then(
    function(result) {
      if (result.isCancelled) {
        console.log('Share cancelled');
      } else {
        console.log('Share success');
      }
    },
    function(error) {
      console.log('Share fail with error: ' + error);
    }
  );
  }

Environment

System: OS: macOS 10.15.4 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 156.75 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.15.2 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 Build Tools: 26.0.2, 27.0.1, 27.0.2, 27.0.3, 28.0.3 System Images: android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6392135 Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild Languages: Java: 1.8.0_211 - /usr/bin/javac Python: 2.7.16 - /usr/local/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found

ayush-shta commented 4 years ago

Works in real device only with the Facebook app installed.