firescript / nativescript-contacts

A nativescript module that gives access to the native contact directory.
MIT License
28 stars 32 forks source link

TypeError: null is not an object (evaluating 'foundContacts.count') #77

Open vatsenko opened 5 years ago

vatsenko commented 5 years ago

Here is my code:

addressbook.getContact().then((args) =>{ if (args.response === "selected") { let contact = args.data; console.log(JSON.stringify(contact)); //contact.name.given = contact.First_Name; //contact.name.family = contact.Last_Name; contact.save(); } });

I got anerror when i try to update:

CONSOLE LOG file:///src/app/services/addressbook.service.ts:102:34: {"id":"1A5D9C7D-AE0C-4DBA-B35F-2E9C610F6995:ABPerson","name":{"given":"4Corners Images","middle":"","family":"","prefix":"","suffix":"","displayname":"","phonetic":{"given":"","middle":"","family":""}},"organization":{"name":"","jobTitle":"","department":""},"nickname":"","notes":"","urls":[],"phoneNumbers":[{"id":"B6E13834-C108-4F9F-B072-D2EFC8F870EB","label":null,"value":"+123"}],"emailAddresses":[{"id":"9F114A07-F0DA-483B-AA7A-0B8122D904D3","label":null,"value":"info@4cornersimages.com"}]}

CONSOLE ERROR file:///node_modules/@angular/core/fesm5/core.js:4002:0: ERROR Error: Uncaught (in promise): TypeError: null is not an object (evaluating 'foundContacts.count') save(file:///node_modules/nativescript-contacts/contact-model.js:136:0) at file:///src/app/services/addressbook.service.ts:107:34 at onInvoke(file:///node_modules/@angular/core/fesm5/core.js:26255:0) at run(file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:138:0) at file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:883:0 at onInvokeTask(file:///node_modules/@angular/core/fesm5/core.js:26246:0) at runTask(file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:188:0) at drainMicroTaskQueue(file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:595:0) at promiseReactionJob([native code]) at UIApplicationMain([native code]) at _start(file:///node_modules/tns-core-modules/application/application.js:295:0) at run(file:///node_modules/tns-core-modules/application/application.js:323:0) at bootstrapNativeScriptApp(file:///node_modules/nativescript-angular/platform-common.js:210:0) at bootstrapApp(file:///node_modules/nativescript-angular/platform-common.js:111:0) at bootstrapModule(file:///node_modules/nativescript-angular/platform-common.js:91:0) at file:///app/bundle.js:1120:144 at ./main.ts(file:///app/bundle.js:1125:34) at __webpack_require__(file:///src/webpack/bootstrap:750:0) at checkDeferredModules(file:///src/webpack/bootstrap:43:0)