[TIMOB-20407] Ti.Contacts.save() unresponsive on iOS>=9
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2016-04-05T06:24:14.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | n/a |
Labels | ios, qe-.5.4.0 |
Reporter | Rhys Leo Coronado |
Assignee | Srikanth Sombhatla |
Created | 2016-02-15T15:02:48.000+0000 |
Updated | 2016-06-09T22:31:29.000+0000 |
Description
Hi, I'm trying to use Ti.Contacts.save() in iOS>=9, but it seems unresponsive or isn't saving at all.
I get this kind of error when trying to use methods like Ti.Contacts.Person (object).setPhone()
{"message":"-\[CNContact setPhoneNumbers:\]: unrecognized selector sent to instance 0x7fb6b34d5980")
We're using the default or unmodified TiContactsPerson.m
var win = Ti.UI.createWindow({
backgroundColor: '#ffffff'
});
var button = Ti.UI.createButton({
width: 200,
height: 50,
title: "Save to address book"
});
win.add(button);
function performAddressBookFunction() {
// sample stopped working on 5.1.2.GA
// var people = Ti.Contacts.getAllPeople();
// var contactsToSave = [];
//
// for (var i=0; i<people.length; i++) {
// contactsToSave.push(people[i]);
// Ti.Contacts.removePerson(people[i]);
// }
//
// Ti.Contacts.save(contactsToSave);
// contactsToSave = [];
Ti.Contacts.createPerson({
firstName: 'Rey',
lastName: 'Bumalay',
phone: {
mobile: ['+63 9176490093', '+63 9176490094'],
'Toll Free': ['1 800 1000000']
},
email: {
work: ['john@doe.com'],
'Personal Email': ['reyjexter@gmail.com']
},
url: {
homepage: ['http://www.google.com'],
'Resume/CV/BIO': ['http://www.myresume.com'],
'Schedule as a Service': ['http://www.service.com']
}
});
alert("Successfully saved");
}
function addressBookDisallowed() {
alert("Address book disallowed");
}
button.addEventListener('click', function(e) {
if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_AUTHORIZED){
performAddressBookFunction();
} else if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_UNKNOWN){
Ti.Contacts.requestAuthorization(function(e){
if (e.success) {
performAddressBookFunction();
} else {
addressBookDisallowed();
}
});
} else {
addressBookDisallowed();
}
});
win.open();
To add: {"message":"-[CNContact setPhoneNumbers:]: unrecognized selector sent to instance 0x7fb6b34d5980") ^It happens with setEmail(), setUrl(), setAddress(), setInstantMessage with their respective error setEmail, setUrl, setAddress, setInstantMessage unrecognized selector sent to instance.
This may already be fixed in 5.2.0. [~ssombhatla] check it out?
[~rlcoronado] We currently don't support custom labels like
Toll Free
,Personal Email
. For example the supported labels for phone are https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Contacts.Person-property-phoneThis is still an issue in 5.2.0 and it is not related to the customer labels mentioned.
f.person.setAddress(currentAddress) throws this error:
In addition, as mentioned, setPhone(), setEmail(), and setUrl() also throw a similar error. This same code works fine in iOS versions below 9
Reopened for validation.