Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18173] iOS: adding date property for Ti.Contacts.createPerson causes error

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-01-06T20:42:15.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsn/a
ReporterVisalakshi Chidambaram
AssigneeChee Kiat Ng
Created2014-12-10T09:09:01.000+0000
Updated2015-01-16T23:14:56.000+0000

Description

This is not a regression as it is reproducible with Titanium sdk 3.4.1 When a new contact is added to the device, adding the date property along with it, following the format in the docs gives error. When the following is done:
    var person = Ti.Contacts.createPerson({
        firstName: 'Aaron',
        lastName: 'Smith',
          date: {
             anniversary: ['2002-11-11T11:23:30.000+0000'],
             other: ['2011-04-02T12:00:00.000+0000']
        }
    });
it cause the error mentioned in step 1 of the actual results, however adding the date property separately as follows:
     person.date = {
         anniversary: ['2022-11-11T11:23:30.000+0000'],
         other: ['2003-04-02T12:00:00.000+0000']
     };
does not cause any error, however the contact does not get added to the device contacts. The birthday field works fine though it also follows the same format as the date. Steps to reproduce: 1. Run the attached app.js 2. Open device contacts and check for Ade Crude Actual results: 1. The following error is shown:
[ERROR] :  Script Error {
[ERROR] :      column = 42;
[ERROR] :      line = 39;
[ERROR] :      message = "-[__NSCFConstantString countByEnumeratingWithState:objects:count:] unrecognized selector sent to instance 0x5d7014";
[ERROR] :      sourceURL = "file:///private/var/mobile/Containers/Bundle/Application/1CCC7A89-6FEA-4909-8277-AA526270ABE2/timob9589.app/app.js";
[ERROR] :      stack = "[native code]\ncreateUpdateContact@file:///private/var/mobile/Containers/Bundle/Application/1CCC7A89-6FEA-4909-8277-AA526270ABE2/timob9589.app/app.js:39:42\nglobal code@file:///private/var/mobile/Containers/Bundle/Application/1CCC7A89-6FEA-4909-8277-AA526270ABE2/timob9589.app/app.js:14:21";
[ERROR] :  }
2. No new contacts added Expected results: 1. Blank white screen appears 2. 'Ade Crude' is added to the contacts along with the anniversary dates and other details mentioned in app.js

Attachments

FileDateSize
app.js2014-12-10T09:09:01.000+00002802

Comments

  1. Chee Kiat Ng 2015-01-05

    PR here: https://github.com/appcelerator/titanium_mobile/pull/6533
  2. Ewan Harris 2015-01-16

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150116070927 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.1.1 iPhone 6 Plus (8.1.1), iPad Air 2 (8.2b4) Using the attached app.js built to both devices. App no longer crashes and the contact is added to the contacts list. Closing ticket.

JSON Source