Skip to content
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

Unable to load native module #37

Open
thekevinbrown opened this issue Mar 1, 2017 · 9 comments
Open

Unable to load native module #37

thekevinbrown opened this issue Mar 1, 2017 · 9 comments

Comments

@thekevinbrown
Copy link

This is on iOS, React Native v0.41.2, using react-native-social-share v1.0.0.

I'm trying to use this module to share directly to Twitter. I keep getting, "undefined is not an object (evaluating 'KDSocialShare.tweet')

I dug into it a bit more, and it looks like react-native-social-share.js is assuming it's able to load the native module. So I was curious why the native module wasn't loading.

I looked in the .xcodeproj file that came down with the module, and it doesn't have a library target like the other react native modules that I'm using have:

screen shot 2017-03-01 at 2 12 15 pm

Which means in the Link Library with Binaries phase, there's no .a file to link to, which would mean that the class never gets built into the app.

I can create this target and add it to the project then PR it back in, but I'm wondering why it's not there to begin with and how everyone else is getting this to work.

I installed this by following the instructions in the readme (e.g. react-native link)

Can anyone shed some light?

@doefler
Copy link
Owner

doefler commented Mar 1, 2017

Hi @blargity

Thank you for using the repo 😄 and for the very comprehensive bug description.

I made the .xcodeproj file around 2 years ago and until this commit (16def72) 19 days ago, the readme instructions were different.

I was not aware of the new instructions demanded an update to .xcodeproj

If you want to make a PR, it would be amazing!

Thank you again.

@dwilt
Copy link

dwilt commented Mar 10, 2017

@doefler what is the fix needed here? We're stuck with a broken share in our app because of this.

@reimertz
Copy link

@blargity is this PR happening? Just tried this thing out but can't get it to work. :)

@reimertz
Copy link

@dwilt I managed to get it to work by

yarn add react-native-social-share
react-native link

then open xCode and

  1. go to Build Phases, press +, Search for and add Social.framework
  2. open node_modules/react-native-social-share/iOS and drag KDSocialShare.m and KDSocialShare.hto Libraries folder in xCode

After that, this example should work

import { shareOnTwitter } from 'react-native-social-share'

    shareOnTwitter({
      'text':'Epic Cat',
      'imagelink':'http://thecatapi.com/api/images/get?format=src',
    }, (results) => {
      console.log(results)
    })

@sibelius
Copy link

@blargity do you still have this problem?

@thekevinbrown
Copy link
Author

We ended up shipping without using react-native-social-share because of this issue, so I don't, but can't verify whether it was solved or not.

@RockinRonE
Copy link

RockinRonE commented Aug 15, 2017

I'm also having this problem, but react-native-social-share does work. Just an FYI

screen shot 2017-08-15 at 2 14 41 pm

@candytrickster
Copy link

How would you do this if you used the create-react-native-app and expo? It doesn't have a xcode project file.

@reimertz
Copy link

reimertz commented Nov 12, 2017

@candytrickster you probably have to eject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants