Start a new topic

TypeError: kinvey_nativescript_sdk_1.Kinvey.ping is not a function

Hello everybody,

I am new in nativescript, I want to connect my app with kinvey.

I get this error when i want to test the connexion between my app and the backend service

kinvey_nativescript_sdk_1.Kinvey.ping is not a function

Thanks in advance


1 person has this question

Mactar,

I see you have an app named 'gardor' whose kid is ending with "....PF9Z". We support NativeScript version 3.x and above. Following are few questions for you:

  1. Are you using 'TypeScript' or 'JavaScript'? Can you provide me with the code snippet that you are using to connect your app with Kinvey?
  2. Can you confirm that you are following all the steps mentioned on https://devcenter.kinvey.com/nativescript/guides/getting-started#top?
  3. Can you please provide me with a screenshot of the error?

You’ll need to use 'App Key' and 'App Secret' to configure your app.

Thanks,
Pranav



1 person likes this

Hello,

Thank you for your response

I have nativescript 3.1.3 configured in my computer. Also i'm using typescript. After installing kinvey-nativescript-sdk and after importing it.This is the code snippet that i'm using to connect my app with kinvey:

 

Kinvey.init({

appKey: '------',

appSecret: '---------------------------'

});

Kinvey.ping()

.then((response) => {

console.log(`Kinvey Ping Success. Kinvey Service is alive, version: ${response.version}, response: ${response.kinvey}`);

})

.catch((error) => {

console.log(`Kinvey Ping Failed. Response: ${error.description}`);

});


I confirm to have followed all the instructions that are in the getting started.


By the way, I use an emulator to test the connection between my application and kinvey.
Mactar,

  1. What version of the Kinvey SDK you are using?
  2. Please take a look at our sample apps on this link.

Looking at all the data you provided, I want you to confirm few things.

  • Can you make sure you have the latest tns-core-modules?

    rm -rf node_modules
    rm -rf platforms
    tns plugin remove tns-core-modules
    tns plugin add tns-core-modules  // or tns plugin add tns-core-modules@next for the next verison
    tns run android // or ios
    
    
  • If you run tns doctor and you will see version information of 'tns-core-modules'. You should update the tns-core-modules, this can be done using the following npm command (In the root of your project):

    npm install tns-core-modules@latest --save
    
  • You can also try to delete node_modules, platforms and hooks folders. You should also remove the app from the device or emulator. Then rebuild your project with tns run android command.


If above suggestion doesn't help, I will need to escalate this issue to our NativeScript experts.


Thanks,

Pranav

Kinvey




Login or Signup to post a comment