react-native-social-share icon indicating copy to clipboard operation
react-native-social-share copied to clipboard

Can't install this module for ios

Open seclace opened this issue 7 years ago • 6 comments
trafficstars

Description

Hi. It is very interesting module and I want to integrate it into my app, but can't. I followed all the instructions in README.md:

  1. yarn add react-native-social-share -E
  2. react-native link react-native-social-share
  3. Add KDSocialShare.h & KDSocialShare.m to Libraries of my project target
  4. Add Social.framework to my project target
  5. And add LSApplicationQueriesSchemes to Info.plist with fb and twitter values Then I ran react-native run-ios or CMD+R in xcode.

First error is

  • 'RCTRootView.h' file not found on 12 line of Libraries/ReactNativeSocialShare.xcodeproj/ReactNativeSocialShare/AppDelegate.m

Solution: #import "RCTRootView.h" could be replaced to #import <React/RCTRootView.h> and this error disappears.

Go further. Next error after "fix" is

  • No visible @interface for 'RCTRootView' declares the selector 'initWithBundleURL:moduleName:launchOptions:'

Solution: Last error disappears after adding initialProperties:nil to rootView declaration in ReactNativeSocialShare/AppDelegate.m, because interface doesn't seems to be identical with used.

Further. Appears another error

  • ld: library not found for -lRCTWebSocketDebugger clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution: As I seen in previous issues I need to remove RCTWebSocketDebugger from Build Phases -> Link Binary from Libraries of ReactNativeSocialShare.xcodeproj.

After latest "fix" another error has appeared

  • ld: library not found for -lRCTAdSupport clang: error: linker command failed with exit code 1 (use -v to see invocation) and if remove this binary from "Linking" then appears 155 errors.

Solution: not found 😞

I believe it is wrong way. Neither I am doing something wrong nor I don't understand the manual and could you, please, go me through the manual?

P.S.

I'm using cocoapods, but it's not matter, because I tried with clear react-native init ProjectName and got the same errors.

Versions:

    "react": "16.3.1",
    "react-native": "0.55.1",
    "react-native-social-share": "1.6.1",

package.json

{
  "name": "GlamAndGo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "remotedev": "remotedev-debugger --injectserver",
    "test": "jest",
    "postinstall": "npm run remotedev && rndebugger-open"
  },
  "dependencies": {
    "credit-card-type": "7.0.0",
    "lodash": "4.17.5",
    "mobx": "4.1.1",
    "mobx-react": "5.0.0",
    "moment": "2.22.1",
    "normalizr": "3.2.4",
    "qs": "6.5.1",
    "react": "16.3.1",
    "react-native": "0.55.1",
    "react-native-blur": "3.2.2",
    "react-native-calendar-events": "1.6.0",
    "react-native-datepicker": "1.7.2",
    "react-native-iphone-x-helper": "1.0.3",
    "react-native-keyboard-aware-scroll-view": "0.5.0",
    "react-native-maps": "0.21.0",
    "react-native-sentry": "0.37.0",
    "react-native-smart-splash-screen": "2.3.5",
    "react-native-social-share": "1.6.1",
    "react-native-svg": "6.3.1",
    "react-native-text-input-mask": "0.7.0",
    "react-native-xml2js": "^1.0.3",
    "react-navigation": "1.5.11",
    "react-redux": "5.0.7",
    "redux": "3.7.2",
    "redux-api-middleware": "2.3.0",
    "redux-persist": "5.9.1",
    "redux-saga": "0.16.0",
    "redux-thunk": "2.2.0",
    "reselect": "3.0.1",
    "validate.js": "0.12.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "flow-bin": "0.67.1",
    "jest": "22.4.3",
    "react-native-debugger-open": "0.3.17",
    "react-test-renderer": "16.3.1",
    "reactotron-react-native": "1.14.0",
    "reactotron-redux": "1.13.0",
    "redux-logger": "3.0.6",
    "remote-redux-devtools": "0.5.12",
    "remotedev-rn-debugger": "0.8.3",
    "uws": "9.148.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "remotedev": {
    "hostname": "localhost",
    "port": 5678
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

seclace avatar Jun 19 '18 10:06 seclace

I've installed this lib via npm today, and got this error

.../node_modules/react-native-social-share/iOS/AppDelegate.m:12:9: fatal error: 'RCTRootView.h' file not found

And everything started to work correctly after I removed this two objects that were added after running react-native link react-native-social-share

screen shot 2018-07-23 at 4 15 28 pm

I hope it helps

facuescobar avatar Jul 23 '18 19:07 facuescobar

I just discovered this project and noticed that the instructions were different from various other libraries. After discovering the same two items that @facuescobar saw in the link phase, I abandoned the react-native link part of the documentation (for iOS only really — by reverting the changes that were made during the link).

Ideally this library would produce a linkable static library for iOS like other RN extensions do which would also allow the removal of all of the fiddling in the Xcode project since those things would be handled automatically.

wbyoung avatar Sep 17 '18 03:09 wbyoung

Hey @wbyoung Thank you for sharing your find. I think it sounds like a good solution. Do you know how to produce a linkable static library for iOS? I would be happy to accept a PR 😄

doefler avatar Sep 17 '18 09:09 doefler

@doefler I do… unfortunately I don't have time right now. Also, at this point I was just investigating this library and as we solidified the feature I was building we decided it wasn't needed, so I can't quite justify the time on it right now. I can point to libraries that I know do this, though if it helps:

I've only contributed to these types of libraries at this point & haven't built one from scratch, but since most of them support linking in the same style, I'd imagine that a guide or template exists that shows how to do it in the "standard" way that all of these libraries are doing. That sort of thing may not have existed when you started this project, but perhaps it does now.

Best of luck & if we do end up needing this, I'll try to send something your way!

wbyoung avatar Sep 18 '18 21:09 wbyoung

@facuescobar where did you find those two objects to delete? I could see them in "recovered references" but not in a similar way to your screenshot, and deleting them did nothing - thanks!

dancherb avatar Nov 29 '18 04:11 dancherb

@dancherb This is a little late, but @facuescobar is referring to "un-linking" the libraries.

On your Project tab -> Build Phases -> Link Binary With Libraries, select both ReactNativeSocialShare.app and ReactNativeSocialShareTests.xctest, and click - to remove them both from your linked libraries. That should clear up the build error.

Hopefully that helps!

ddeftly avatar Feb 18 '19 16:02 ddeftly