react-native-linkedin-sdk
react-native-linkedin-sdk copied to clipboard
Cannot read property 'configure' of undefined (LinkedInSessionManager.ios.js)
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.
I started working with this yesterday, and have been getting the same error triggered by the same lines of code, although--
- My configuration looks like this:
and
- I'm passing my
clientID,clientSecret, etc. into theLinkedInSDK.signInfunction instead of aconfigurefunction. (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.
I have the same problem. Did someone get it to work?
@freework-tech I haven't yet. 😢
@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
@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)
})
}
Merged https://github.com/joonhocho/react-native-linkedin-sdk/pull/11. Sorry guys, I was busy working on something else.
No worries! I'll try again later this week and report back.
Doesn't work for me :-(
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:
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.
@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.