[TIMOB-19739] iOS: Ti.Contacts custom phone label in phones become undefined
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-10-21T17:38:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.1.0, Release 5.2.0 |
Components | iOS |
Labels | contacts, ios, iphone |
Reporter | jack sparrow |
Assignee | Chee Kiat Ng |
Created | 2015-10-16T06:51:02.000+0000 |
Updated | 2015-11-09T12:20:30.000+0000 |
Description
i need urgent solution for this bug in Contacts list phone numbers , IOS
if i have contact he's phone number saved in custom label the phone numbers of this contact object return "undefined"
var people = Ti.Contacts.getAllPeople();
for ( var i = 0 ; i < people.length; i++)
{
var person = people[i];
var contactPhones = person['phone'] ;//should be array
//if contact has phone number saved as custom label return undefined;
Ti.API.info(i+' - Contact Phones '+contactPhones);
}
anyone ?
[~jackSparrow] we have been able to reproduce the issue and will schedule it asap.
PR here : https://github.com/appcelerator/titanium_mobile/pull/7322
Tested the above demo code using the PR of [~cng]. Works fine, FT approved, PR merged, ticket resolved. Thank you!
yes the above demo by Chee is working fine on custom labels , but it cost another issue , when add new contact has default label it gives Error exception , for example add new contact but don't change the label keep it "phone" :
Console print out exception Error for new contact :
[~jackSparrow], sorry, I might be missing something here, i had no problem adding a new contact with default settings. can you write an example code (in JS) that explains the new problem?
Sorry my bad in explain , here what i did : 1- open phone dialog , write any phone number . 2- click on + icon to create new contact ( the number your wrote in dialog ) . 3- by default the label will be "phone" keep it and click save . now get contacts list using above code with bug fix , you will get Error exception :
i did not tested it on simulator , tested on my iPhone.
good catch [~jackSparrow], this should be an apple bug since it's that value should be nonnull as according to the docs here: https://developer.apple.com/library/ios/documentation/Contacts/Reference/CNLabeledValue_Class/#//apple_ref/occ/instp/CNLabeledValue/label But PR here anyway, until Apple fixes it. https://github.com/appcelerator/titanium_mobile/pull/7325
@Chee Kiat Ng , you are the man (y)
PR tested and approved. [~jackSparrow], we will also supply this fix in the upcoming 5.1.0 version instead of 5.2.0. Thank you!
Verified as fixed, tested on 9.1 iPhone 6S Plus device, using 5.0.2.GA release, I am able to reproduce the error. Creating a contact with custom label "phone" and running the app will log the contact as "undefined". rebuilding app with release 5.1.0.v20151021165224, the error is no longer reproducible. Mac OSX El Capitan 10.11 (15A284) Studio: 4.3.3.201510201834 Ti SDK: 5.1.0.v20151021165224 Appc NPM: 4.2.1-6 Appc CLI: 5.2.0-24 Ti CLI: 5.0.4 Xcode 7.1(7B91b) Node v0.12.7 production *Closing ticket.*