PDA

View Full Version : phonegap and sencha touch



kenjibizweb
1 Aug 2011, 3:14 AM
hi, i have been trying with phonegap and sencha touch contact sample. It is working in simulator but not on the actual devices. iPhone 3gs and iPhone 4.0. It show the errors as below...anyone have any ideas?

2011-08-01 19:06:38.113 contactiphone4[362:607] [INFO] Error in success callback: Contacts.search0 = TypeError: Result of expression 'a.name' [undefined] is not an object.
[Switching to process 13571 thread 0x0]

Thank you.

rmoriz
17 Aug 2011, 2:07 PM
I'm using the example code from github with phonegap 1.0.0 on ios5b5 and experience the same problem.

But I'm getting a different error message:

(big json log output of all contacts)
PhoneGap.callbackSuccess('com.phonegap.contacts.search0',temp);
2011-08-18 00:00:30.327 example[2111:707] [INFO] Error in success callback: com.phonegap.contacts.search0 = TypeError: 'undefined' is not an object

jameswiltshire
19 Sep 2011, 5:44 AM
I ran into this issue also when attempting to perform on-device testing. The problem appears to occur when there are entries in your device contacts that contain null values. The sample code for the Contacts app doesn't have much null checking around the model (where 'familyName' is used for sorting and the first letter of familyName is used for grouping).
Simplest solution to allow the app to start up without errors is to ignore any entries from your device contacts that have null values for the name.

Add the following to models/Contact.js immediately after the var deviceContact=deviceContacts[i]; line in the 'contact storage' proxy read function.

if (!deviceContact || !deviceContact.name || !deviceContact.name.familyName || !deviceContact.name.givenName){continue;}

Regards
James Wiltshire