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

Cannot read property 'configure' of undefined (LinkedInSessionManager.ios.js) #9

Open
dittmarconsulting opened this issue May 3, 2017 · 10 comments

Comments

@dittmarconsulting
Copy link

dittmarconsulting commented May 3, 2017

Hi all,

I have followed all steps described here

Here is props of my environment:

react - 16.0.0-alpha.6
react-native - 0.43.3
react-native-linkedin-sdk - 0.0.4
XCode - 8.3.2

The Xcode project compiles without issues but I receive an error msg when I invoke the JS code below that the function configure is undefined

Here is my test code:

const config = {
   clientID: '<my client id>',
   clientSecret: '<my secret>',
   state: '<my state hash>',
   scopes: 'r_basicprofile',
   redirectUri: '<my redirect URL>'
}
const LISDK = LinkedInSDK.configure(config)

The code snipped that causes the error is in LinkedInSessionManager.ios.js

...
const LinkedInSDK = {
   configure(config) {
      console.info('LINKEDIN SESSION MANAGER', RNLinkedInSessionManager)
      return RNLinkedInSessionManager.configure(config);
    },
    ...
};

module.exports = LinkedInSDK;

I added a console output to check whether I get a RNLinkedInSessionManager object but I get an undefined.

The file RNLinkedInSessionManager.xcworkspace has been successfully added to my XCode project folder under /ios but it seems there is no link to the library.

Any help is much appreciated.

@bethqiang
Copy link

bethqiang commented May 3, 2017

I started working with this yesterday, and have been getting the same error triggered by the same lines of code, although--

  1. My configuration looks like this:

screen shot 2017-05-03 at 8 45 12 am

and

  1. I'm passing my clientID, clientSecret, etc. into the LinkedInSDK.signIn function instead of a configure function. (Per the usage section in the Read Me.)

Regardless, I'm still getting the same error triggered by the same lines of code and I'm a little lost on how to go about fixing this.

@freework-tech
Copy link

I have the same problem. Did someone get it to work?

@bethqiang
Copy link

@freework-tech I haven't yet. 😢

@freework-tech
Copy link

@bethqiang: I figured it out:
You have to add the two files in the folder RNLinkedInSessionManager to Build Phases -> Compile Sources in your project target settings (drag & drop)

Let me know if it works

@dittmarconsulting
Copy link
Author

dittmarconsulting commented May 18, 2017

@freework-tech

Your solution doesn't work for me.

I also updated the code by hand in RNLinkedInSessionManager.swift file as suggested but I still get the same error - RNLinkedInSessionManager is undefined

DispatchQueue.main.sync() {
          linkedinHelper.authorizeSuccess({ (lsToken) in
              // Delay is necessary as ViewController is closing.
              DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                  resolve(RNLinkedInSessionManager.tokenToJSON(lsToken))
              }
          }, error: { (error) in
              reject("authorizeSuccessError", error.localizedDescription, error)
          }, cancel: {
              reject("authorizeSuccessCancel", "", nil)
          })
        }

@joonhocho
Copy link
Owner

joonhocho commented Jun 5, 2017

Merged #11. Sorry guys, I was busy working on something else.

@bethqiang
Copy link

No worries! I'll try again later this week and report back.

@dittmarconsulting
Copy link
Author

Doesn't work for me :-(

@bethqiang
Copy link

bethqiang commented Jun 12, 2017

I had to use @freework-tech's solution in addition to using the latest version, but things worked!

Re: @freework-tech's solution, this is what my Xcode looked like per that:

screen shot 2017-06-12 at 2 28 49 pm

I ended up deleting the RNLinkedInSessionManager folder (bullet point 4 in the iOS section of the README right before "Usage") after doing this to see what would happen, and it appears it didn't affect the functioning of anything.

@joonhocho
Copy link
Owner

@bethqiang @dittmarconsulting It seems like there is no clean solution for these problems, cuz it works for some and doesnt for others.
If things are not working, refer to the ExampleApp. I currently don't know exactly how XCode compiles its codes and react-native.

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

4 participants