Git Product home page Git Product logo

Comments (8)

Sunny41 avatar Sunny41 commented on May 14, 2024 1

i created one here : https://github.com/Sunny41/contactsx-example
it has a simple button on the homepage and the same code I posted above in the chooseContact() method :)

from cordova-plugin-contacts-x.

EinfachHans avatar EinfachHans commented on May 14, 2024

Please post the full code which is related to this including the pick method and stuff

from cordova-plugin-contacts-x.

Sunny41 avatar Sunny41 commented on May 14, 2024

import ContactsX from 'cordova-plugin-contacts-x'
...


    ContactsX.requestPermission(function (success) {

      ContactsX.pick(function (contact) {

        console.log(success);

        console.log(contact);

        console.log(contact.firstName);

        const contactInfo = contact;

        console.log(contactInfo);

        this.name = contactInfo.firstName;

        ...

      }, function (error) {

        console.log(error);

      });

    }, function (error) {

      console.log(error);

    });

  }```

from cordova-plugin-contacts-x.

EinfachHans avatar EinfachHans commented on May 14, 2024

So the error happens here: this.name = contactInfo.firstName;?

But the line before is printing the contact correctly with firstName?

from cordova-plugin-contacts-x.

Sunny41 avatar Sunny41 commented on May 14, 2024

exactly :)
I tried to do that without using a new variable and the same error occurs...
tried that with ios 12 on an iphone 5 and with the simulator of an iphone 12 with ios 14

from cordova-plugin-contacts-x.

EinfachHans avatar EinfachHans commented on May 14, 2024

That doesn't make sense 🤯 pls create a small reproducable repo

from cordova-plugin-contacts-x.

Sunny41 avatar Sunny41 commented on May 14, 2024

Hi there again,
I tested it on the android emulator with pixel XL and on my physical device samsung galaxy s10 with android 11.

cordova.js:314 Uncaught TypeError: Cannot set property 'name' of null at main.js:6755 at Object.callbackFromNative (cordova.js:295) at <anonymous>:1:9

from cordova-plugin-contacts-x.

EinfachHans avatar EinfachHans commented on May 14, 2024

Hey there. Sorry for the late response.

I just checkout your Repo. The problem is not that firstName is null, the problem is that there is no variable name, so this.name can't work.

And even if there was a class variable called name it may not work. Please read this: https://logicmason.com/2019/how-to-access-this-from-inside-a-callback/

from cordova-plugin-contacts-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.