Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20407

Ti.Contacts.save() unresponsive on iOS>=9

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: Release 5.4.0
    • Component/s: None
    • Labels:
    • Environment:

      Mac OSX El Capitan, iOS Emualator 9.2, 9.1

      Ti SDK 5.1.2.GA

      Description

      Hi, I'm trying to use Ti.Contacts.save() in iOS>=9, but it seems unresponsive or isn't saving at all.

      I get this kind of error when trying to use methods like Ti.Contacts.Person (object).setPhone()

      {"message":"-[CNContact setPhoneNumbers:]: unrecognized selector sent to instance 0x7fb6b34d5980")

      We're using the default or unmodified TiContactsPerson.m

      var win = Ti.UI.createWindow({
      	backgroundColor: '#ffffff'
      });
       
       
      var button = Ti.UI.createButton({
      	width: 200,
      	height: 50,
      	title: "Save to address book"
      });
       
      win.add(button);
       
       
      function performAddressBookFunction() {
      	// sample stopped working on 5.1.2.GA
      	// var people = Ti.Contacts.getAllPeople();
      	// var contactsToSave = [];
      // 	
      	// for (var i=0; i<people.length; i++) {
      		// contactsToSave.push(people[i]);
      		// Ti.Contacts.removePerson(people[i]);
      	// }
      // 	
      	// Ti.Contacts.save(contactsToSave);
      	// contactsToSave = [];
      	
      	Ti.Contacts.createPerson({
      	  	firstName: 'Rey',
      	  	lastName: 'Bumalay',	
      	  	phone: {
      	  		mobile: ['+63 9176490093', '+63 9176490094'],
      	  		'Toll Free': ['1 800 1000000']
      	  	},
      	  	email: {
      	  		work: ['john@doe.com'],
      	  		'Personal Email': ['reyjexter@gmail.com']
      	  	},
      	 	url: {
      	  		homepage: ['http://www.google.com'],
      	  		'Resume/CV/BIO': ['http://www.myresume.com'],
      	  		'Schedule as a Service': ['http://www.service.com']
      	  	}
      	});
      	
      	alert("Successfully saved");
      }
       
      function addressBookDisallowed() {
      	alert("Address book disallowed");
      }
      	
       
      button.addEventListener('click', function(e) {
      	
      	if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_AUTHORIZED){
      	    performAddressBookFunction();
      	} else if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_UNKNOWN){
      	    Ti.Contacts.requestAuthorization(function(e){
      	        if (e.success) {
      	            performAddressBookFunction();
      	        } else {
      	            addressBookDisallowed();
      	        }
      	    });
      	} else {
      	    addressBookDisallowed();
      	}
      });
       
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ssombhatla Srikanth Sombhatla (Inactive)
                Reporter:
                rlcoronado Rhys Leo Coronado
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20959
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration