I am trying to get contacts from iphone4s (ios 8.1.2) using the following code snippet.
if (Ext.os.deviceType == 'Phone'){
var contactsConfig = {
success: function( contacts){
Ext.Msg.alert('Contacts?', contacts.length, Ext.emptyFn);
},
failure: function(context){
Ext.Msg.alert('Failure', 'It did not work.', Ext.emptyFn);
},
scope: this,
includeImages: false
};
Ext.device.Contacts.getContacts(contactsConfig);
}
My phonegap config.xml has permission to read contacts
<feature name="Contacts">
<param name="ios-package" value="CDVContacts" />
</feature>
But I always end up getting contacts hard-coded in Ext.device.contacts.Abstract
Has anyone able to get contacts working on sencha touch 2.4.x? Or even older versions ?
Any help would be much appreciated.
I was able to solve the problem after a lot of hacks.
Step 1: Phonegap can read iOS contacts.
Step 2: Calling Ext.device.contacts.getContacts(). Sencha touch 2.4 documentation is wrong.
Step 3: Passing correct parameter to navigator functions. Also Ext.browser.is.Cordova or .Sencha doesn't work. So replace them.
Step 4: Cordova.js is needed for navigator functions to work.
Making sure in phonegap project, config.xml at different locations( i.e. , /www, //) have following in it
Calling get contacts() the correct way