Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2542] Ti.Contacts.createPerson undefined

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:24.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M05
ComponentsAndroid
Labelsandroid, enterprise
ReporterKevin Whinnery
AssigneeBill Dawson
Created2011-04-15T03:22:15.000+0000
Updated2011-04-17T01:59:24.000+0000

Description

Using 1.5 http://github.com/appcelerator/titanium_mobile/commit/43358e5f7b4bb194f79e343398f648008b353293"> continuous build (Dec. 9), I confirm that Ti.Contacts.createPerson is undefined for the Ti.Contacts namespace. This is a documentation or a functional bug to be addressed. Code that should work:


var contacts = Ti.Contacts.getPeopleWithName('Johnson');
var contact = Ti.Contacts.createPerson();
contact.firstName = 'John';
contact.lastName = 'Smith';
contact.phone = {'work':['5555555555']};
contact.email = {'work':['foo@bar.com']};
contact.address = {
    'home':[{
        street: '555 Happy Drive',
        city: 'Saint Paul',
        state: 'MN',
        postalCode: '55119',
        country: 'US'
    }]
};
Ti.Contacts.save();
Ti.API.info('Contact added');

Produces:

[TRACE] E/KrollContext( 400): (kroll$1) [127,940] ECMA Error evaluating source: TypeError: Cannot find function createPerson in object [Ti.Contacts]. (app://app.js#1)
[TRACE] E/KrollContext( 400): org.mozilla.javascript.EcmaError: TypeError: Cannot find function createPerson in object [Ti.Contacts]. (app://app.js#1)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3761)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3739)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3767)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3786)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3850)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2343)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1524)
[TRACE] E/KrollContext( 400): at script(app://app.js:1)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
[TRACE] E/KrollContext( 400): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
[TRACE] E/KrollContext( 400): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:195)
[TRACE] E/KrollContext( 400): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:220)
[TRACE] E/KrollContext( 400): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:115)
[TRACE] E/KrollContext( 400): at android.os.Handler.dispatchMessage(Handler.java:95)
[TRACE] E/KrollContext( 400): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/KrollContext( 400): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)
[TRACE] E/TiContext( 400): (kroll$1) [24,964] Rhino Error: app://app.js:1,0
[TRACE] E/TiContext( 400): (kroll$1) [2,966] Message: TypeError: Cannot find function createPerson in object [Ti.Contacts]. (app://app.js#1)
[TRACE] E/TiContext( 400): (kroll$1) [1,967] Source: null

Comments

  1. Bill Dawson 2011-04-15

    #1894 is for read-write contacts. Will update documentation, however.

  2. Bill Dawson 2011-04-15

    (from [b8f0c4d69b3999f794ef110f0dae90dc7a7b77e4]) [#2542 state:fixed-in-qa] Documentation fix only. Add notations that contacts in android are currently only read-only. Ticket 1894 addresses adding read-write functionality. https://github.com/appcelerator/titanium_mobile/commit/b8f0c4d69b3999f794ef110f0dae90dc7a7b77e4"> https://github.com/appcelerator/titanium_mobile/commit/b8f0c4d69b39...

  3. Nikolai Derzhak 2011-04-15

    rollback wrong update

JSON Source