Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20118] iOS9: Contacts property fullName does not return appropriate values

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2015-12-08T23:53:12.000+0000
Affected Version/sRelease 5.1.2
Fix Version/sRelease 5.1.2
ComponentsiOS
Labelsqe-5.1.2
ReporterHarry Bryant
AssigneeAngel Petkov
Created2015-12-08T21:03:25.000+0000
Updated2015-12-09T21:43:39.000+0000

Description

Description: Created a test contact with values given to all properties, when logging fullName to the console, it does not display the associated variables in the correct order, and middleName is replaced by organisation:

*Note: This issue only occurs for iOS9, and fullName property returns the correct variables when built to an iOS8 device/ sim.*
[INFO] :   firstName: Nathan
[INFO] :   middleName: John
[INFO] :   lastName: Cook
[INFO] :   fullName: Mr III Appcelerator Nathan Cook
[INFO] :   prefix: Mr
[INFO] :   suffix: III

Steps to reproduce:

1. Create a classic project. 2. Include following demo code:
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
 var Nathan ="";
 
    Ti.Contacts.requestAuthorization(function(e) {
        if (e.success == true) {
            alert('Contact Request Authorization success');
        }
        else {
            alert('Contact Request Authorization denied');
        }
    });
    
var createContact = Ti.UI.createButton({
    title: "Create New Contact",
});
 
createContact.addEventListener('click',function(e){
    if (Nathan != null) {
        Nathan = Ti.Contacts.createPerson({
         firstName: 'Nathan',
          lastName: 'Cook',
          middleName: 'John',
          nickname: 'Fish',
          prefix: 'Mr',
          suffix: 'III',
          firstPhonetic: 'N',
          middlePhonetic: 'T',
          lastPhonetic: 'A',
          organization: 'appcelerator',
          department: 'Cloud',
          jobTitle: 'QE',
          note: 'You gotta risk it, to get the biscuit',
          kind: Ti.Contacts.CONTACTS_KIND_PERSON,
          address:{
        work:[
          {
            CountryCode: 'GB', // determines how the address is displayed
            Street: '123 Wales Road',
            City: 'Camarthan',
            Country: 'Wales',
            PostalCode: 'CA35 9TW'
          },
          {
            CountryCode: 'US', // determines how the address is displayed
            Street: '321 America Road',
            City: 'San Jose',
            State: 'CA',
            Country: 'The United States of America',
            PostalCode: '84009'
          }
        ],
        home:[
          {
            CountryCode: 'gb', // determines how the address is displayed
            Street: '2 Boleyn Court',
            City: 'London',
            State: 'Greenwich',
            Country: 'England',
            PostalCode: 'SE10'
          }
        ]
      },
      email:{
       home : [
           'myGmail',
          'myHotmail'
       ],
      work : [
          'myWorkemail'
       ]
       },
         
relatedNames:{
             father: ['Big Daddy','Big Daddy Sr'],
             mother: ['Big Momma', 'Big Momma Sr'],
             child: ['Derek']
         },
         
      birthday: '2012-01-01T12:00:00.000+0000',
      instantMessage:{
        home:[
          {
            service: 'AIM',
            username: 'leisureAIM'
          },
          {
            service: 'MSN',
            username: 'no_paul_here@msn.com'
          }
        ],
        work:[
          {
            service: 'AIM',
            username: 'seriousAIM'
          }
        ]
      },
      organization: 'Appcelerator',
      phone:{
        main: ['07900 000001', '07900 000002'],
        iPhone: ['+44 (0)118 925 6128', '+44 (0)118 000 0000']
      },
      alternateBirthday: {
            calendarIdentifier: 'chinese',
            day: 25,
            era: 78,
            isLeapMonth: false,
            month: 11,
            year: 16
        },
        socialProfile:{
            home:[{
                service: 'facebook',
                username: 'jdeep@facebook.com'
            },
            {
                service: 'gamecenter',
                username: 'jdeep@hotmail.com'
            }],
            work:[{
                service: 'linkedin',
                username: 'jdeep@linkedin.com'
            }]
        },
 
      url:{
        homepage: ['www.google.com'],
        work: ['www.appcelerator.com', 'www.example.com']
      },
      date:{
          anniversary: ['2006-06-25T12:00:00.000+0000','2007-06-25T12:00:00.000+0000'],
          other: ['2009-03-25T12:00:00.000+0000']
      }
    });    
    } else {
        return;
    }
});

var button = Ti.UI.createButton({ 
    title: 'Select Contact', 
    height: '50dp',
    width: '130dp',
    top: '20%' 
});
 
button.addEventListener('click', function(e) {
    Ti.Contacts.showContacts({
        selectedProperty: function(e){
            alert(JSON.stringify(e));
        }
    });
});

button.addEventListener("click", function(e) {
    
 var singleValue = [
  'firstName', 'middleName', 'lastName', 'fullName', 'prefix', 'suffix', 
  'nickname', 'firstPhonetic', 'middlePhonetic', 'lastPhonetic', 'organization', 
  'jobTitle', 'department', 'note', 'birthday', 'kind'
];
var multiValue = [
  'email', 'address', 'phone', 'instantMessage', 'relatedNames', 'date', 'url'
];

var people = Ti.Contacts.getPeopleWithName("Nathan");
Ti.API.info('Total contacts: ' + people.length);
for (var i=0, ilen=people[0]; i<1; i++){
  Ti.API.info('---------------------');
  var person = people[i];

  for (var j=0, jlen=singleValue.length; j<jlen; j++){
    Ti.API.info(singleValue[j] + ': ' + person[singleValue[j]]);
  }
 }
});
win1.add(button);  
win1.add(createContact);
win1.open();
3. Build to iOS9 simulator or device. 4. Open app and click "Create Contact" 5. Click "Select Contact" and review log for lastName property. 6. repeating steps 1-5 and building for iOS8 will not reproduce the issue.

Result:

prefix , suffix , organisation, firstName, lastName

Expected Result:

prefix, firstName, middleName, lastName, suffix

Comments

  1. Angel Petkov 2015-12-08

    PR pending:https://github.com/appcelerator/titanium_mobile/pull/7557. PR (5_1_2) : https://github.com/appcelerator/titanium_mobile/pull/7560
  2. Harry Bryant 2015-12-09

    Verified as fixed, the fullName property now displays the appropriate values, in the correct order: prefix, firstName, middleName, lastName, suffix Tested with: iPhone 6s Plus Device (9.1) & Simulators (9.1) , (8.4) Mac OSX El Capitan 10.11 (15A284) Studio: 4.4.0.201511241829 Ti SDK: 5.1.2.v20151208161231 Appc NPM: 4.2.2 App CLI: 5.1.0 Xcode 7.1(7B91b) Node v4.2.2 production *Closing ticket.*

JSON Source