React Native SDK的使用方法returns undefined
Using method of React Native SDK returns undefined
我正在使用 ConnectyCube React Native SDK,但还没有深入了解它。使用它的方法时,我收到错误消息说它们未定义,如下所示:TypeError: Cannot read property 'createSession' of undefined
。当我 console.log ConnectyCube.createSession
它记录:
ƒ createSession(params, callback) {
this.auth.createSession(params, callback);
}
.
我已经使用 react-native link connectycube-reactnative
链接了包,就像我在其他帖子上看到的那样,但我仍然遇到同样的问题。任何人都知道出了什么问题或我该如何解决?提前致谢。
import ConnectyCube from 'connectycube-reactnative'
import config from './ConnectycubeConfig'
export default function App() {
console.log(ConnectyCube.createSession)
var userCredentials = {login: 'xxxxxxxxx', password: 'xxxxxxxx'};
ConnectyCube.createSession(userCredentials, (error, session) => {
}); // 'TypeError: Cannot read property 'createSession' of undefined'
我不是专家反应。所看到的是存在普遍问题。根据您的错误,它说 'connectyCude' 未定义。试试下面的代码。
import {ConnectyCube} from 'connectycube-reactnative'
import config from './ConnectycubeConfig'
export default function App() {
var cCube = new ConnectyCube();
console.log(cCube.createSession)
var userCredentials = {login: 'xxxxxxxxx', password: 'xxxxxxxx'};
cCube.createSession(userCredentials, (error, session) => {});
}
请设置 proceed
与 session
。
import ConnectyCube from 'connectycube-reactnative'
...
const cbConfig = [
{
appId: 218,
authKey: 'p-cqm2aatn8ZPM3',
authSecret: '3hmGuXN8AHZOgg6',
},
{
debug: { mode: 1 },
},
]
...
componentWillMount() {
ConnectyCube.init(...cbConfig)
ConnectyCube.createSession((failSession, session) => {
if (!failSession, session) {
alert("you can get login")
}
})
}
我正在使用 ConnectyCube React Native SDK,但还没有深入了解它。使用它的方法时,我收到错误消息说它们未定义,如下所示:TypeError: Cannot read property 'createSession' of undefined
。当我 console.log ConnectyCube.createSession
它记录:
ƒ createSession(params, callback) {
this.auth.createSession(params, callback);
}
.
我已经使用 react-native link connectycube-reactnative
链接了包,就像我在其他帖子上看到的那样,但我仍然遇到同样的问题。任何人都知道出了什么问题或我该如何解决?提前致谢。
import ConnectyCube from 'connectycube-reactnative'
import config from './ConnectycubeConfig'
export default function App() {
console.log(ConnectyCube.createSession)
var userCredentials = {login: 'xxxxxxxxx', password: 'xxxxxxxx'};
ConnectyCube.createSession(userCredentials, (error, session) => {
}); // 'TypeError: Cannot read property 'createSession' of undefined'
我不是专家反应。所看到的是存在普遍问题。根据您的错误,它说 'connectyCude' 未定义。试试下面的代码。
import {ConnectyCube} from 'connectycube-reactnative'
import config from './ConnectycubeConfig'
export default function App() {
var cCube = new ConnectyCube();
console.log(cCube.createSession)
var userCredentials = {login: 'xxxxxxxxx', password: 'xxxxxxxx'};
cCube.createSession(userCredentials, (error, session) => {});
}
请设置 proceed
与 session
。
import ConnectyCube from 'connectycube-reactnative'
...
const cbConfig = [
{
appId: 218,
authKey: 'p-cqm2aatn8ZPM3',
authSecret: '3hmGuXN8AHZOgg6',
},
{
debug: { mode: 1 },
},
]
...
componentWillMount() {
ConnectyCube.init(...cbConfig)
ConnectyCube.createSession((failSession, session) => {
if (!failSession, session) {
alert("you can get login")
}
})
}