[ 
https://issues.apache.org/jira/browse/CB-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263127#comment-13263127
 ] 

Shazron Abdullah commented on CB-567:
-------------------------------------

Aha - I couldn't repro this at all until I passed in the phonenumbers not as 
strings but as numbers, but that only threw an exception in 1.6.1, not an app 
crash.

Can you guys try this and report the results? Create a new project and add this 
code, uncomment/comment the appropriate onDeviceReady function in onBodyLoad. 
It only throws an exception on onDeviceReady, not onDeviceReady1 and 
onDeviceReady2.

See:

{code}

        function onBodyLoad()
        {               
                document.addEventListener("deviceready", onDeviceReady, false);
                //document.addEventListener("deviceready", onDeviceReady1, 
false);
                //document.addEventListener("deviceready", onDeviceReady2, 
false);
        }

        function onDeviceReady2()
        {
        var contact = navigator.contacts.create();
        
        // store contact phone numbers in ContactField[]
        var phoneNumbers = [3];
        phoneNumbers[0] = new ContactField('work', '212-555-1236', false);
        phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // 
preferred number
        phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
        contact.phoneNumbers = phoneNumbers;
        
        // save the contact
        contact.save(function() { alert('success'); }, function() { 
alert('error'); });
        }
        
        function onDeviceReady1()
        {
            var contact = navigator.contacts.create();
            
            // store contact phone numbers in ContactField[]
            var phoneNumbers = [];
            
            phoneNumbers.push(new ContactField('123-345-2451', '123-345-2451', 
true));
            contact.phoneNumbers = phoneNumbers;
            
            // save the contact
            contact.save(function() { alert('success'); }, function() { 
alert('error'); });
        }

        function onDeviceReady()
        {
            var contact = navigator.contacts.create();
            
            // store contact phone numbers in ContactField[]
            var phoneNumbers = [];
            
            phoneNumbers.push(new ContactField(1233452451, 1233452451, true));
            contact.phoneNumbers = phoneNumbers;
            
            // save the contact
            contact.save(function() { alert('success'); }, function() { 
alert('error'); });
        }

{code}
                
> Contact save crashes
> --------------------
>
>                 Key: CB-567
>                 URL: https://issues.apache.org/jira/browse/CB-567
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>            Reporter: Stefan Janson
>            Assignee: Shazron Abdullah
>            Priority: Minor
>              Labels: contacts
>             Fix For: 1.7.0
>
>         Attachments: contact-debug.rtf
>
>
> When trying to import new contacts the app silently crahes.
> Phone is synced with EAS (Exchange Active sync) if this could cause trouble?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to