react-native-linkedin-sdk - Cannot read property 'configure' of undefined (LinkedInSessionManager.ios.js)

前端 未结 1 1152
囚心锁ツ
囚心锁ツ 2021-01-24 03:14

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          


        
相关标签:
1条回答
  • 2021-01-24 03:48

    I gave up using the react-native-linkedin-sdk.

    Instead I successfully implemented this library react-native-linkedin-login

    Nevertheless the library doesn't work without some modifications.

    Here my findings:

    Android:

    I followed all steps here but I received the following error:

    Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :react-native-linkedin-login.

    It turns out the path described in the above instructions is wrong. To solve the problem I updated the path in the settings.gradle file like that:

    //project(':react-native-linkedin-login').projectDir = new File(rootProject.projectDir, '../../android')
    project(':react-native-linkedin-login').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linkedin-login/android') 
    

    After that I could successfully build the project.

    iOS:

    After completing all steps as described here you will have a folder RNLinkedinLogin in your XCode project path.

    Drop the LinkedinLogin.m file into the Build Phases -> Compiled Sources

    Both files have the old import syntax but since react native 0.40 and above the syntax has changed. You must edit these imports accordingly.

    Changed the import in file RNLinkedinLogin.m

     // old syntax
     //#import "RCTEventDispatcher.h"
     // new syntax
     #import <React/RCTEventDispatcher.h>
    

    and the import in file 'RNLinkedinLogin.h`

     //#import "RCTBridgeModule.h"
     #import <React/RCTBridgeModule.h>
    

    Your project will now compile without errors.

    Good luck, Tom

    0 讨论(0)
提交回复
热议问题