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

iOS8: Ti.Contacts - relatedNames property causes crash

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 5.1.0
    • Fix Version/s: Release 5.1.2
    • Component/s: iOS
    • Labels:
    • Environment:

      Mac OSX El Capitan 10.11 (15A284)
      SDK: 5.1.0.v20151118092752
      Studio: 4.4.0.201511130407
      Core CLI: 5.1.0-60
      NPM CLI: 4.2.1 GA
      Xcode 7.1(7B91b)
      Node: 0.12.7
      Preproduction

    • Story Points:
      3
    • Sprint:
      2015 Sprint 24 SDK

      Description

      Description:

      Creating a new contact with Ti.createContact() & including the relatedNames will cause the following error when build to an iOS8 Device / Sim:

      [ERROR] :  Script Error {
      [ERROR] :      column = 33;
      [ERROR] :      line = 155;
      [ERROR] :      message = "-[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x17023e340";
      [ERROR] :      sourceURL = "<file:///private/var/mobile/Containers/Bundle/Application/2F169FDD-5809-41DC-82A7-98E5ACB036FC/TIMOB_20010.app/app.js>";
      [ERROR] :      stack = "[native code]<nfile:///private/var/mobile/Containers/Bundle/Application/2F169FDD-5809-41DC-82A7-98E5ACB036FC/TIMOB_20010.app/app.js:155:33>";
      [ERROR] :  }
      

      The same code will work successfully when build to an iOS9 Device / Sim, and removing the relatedNames property resolves the issue for iOS8.

      Steps to reproduce:

      1. Create a Classic Project.
      2. Include following demo code to app.js:

      var win1 = Titanium.UI.createWindow({  
          title:'Tab 1',
          backgroundColor:'#fff'
      });
       
      	Ti.Contacts.requestAuthorization(function(e) {
      		if (e.success == true) {
      			alert('success');
      		}
      		else {
      			alert('no');
      		}
      	});
       
       
       
       
      var createContact = Ti.UI.createButton({
      	title: "Create New Contact",
      });
       
       
       
      createContact.addEventListener('click',function(e){
      	    pong = Ti.Contacts.createPerson({
       		firstName: 'letter',
        		lastName: 'pong',
        		middleName: 'long',
        		nickname: 'fancyPants',
        		prefix: 'Mr',
        		suffix: 'Jr',
        		firstPhonetic: 'a',
        		middlePhonetic: 'b',
        		lastPhonetic: 'c',
        		organization: 'appcelerator',
        		department: 'SDK',
        		jobTitle: 'pingPongChampion',
        		note: 'when i was young, i ping pong to the top',
        		kind: Ti.Contacts.CONTACTS_KIND_PERSON,
        		address:{
          	work:[
      	      {
      	        CountryCode: 'gb', // determines how the address is displayed
      	        Street: '200 Brook Drive\nGreen Park',
      	        City: 'Reading',
      	        Country: 'England',
      	        PostalCode: 'RG2 6UB'
      	      },
      	      {
      	        CountryCode: 'gb', // determines how the address is displayed
      	        Street: '1 St Pauls Road\nClerkenwell',
      	        City: 'City of London',
      	        State: 'London',
      	        Country: 'England',
      	        PostalCode: 'EC1 1AA'
      	      }
      	    ],
      	    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: 'baba',
         	  	mother: 'mama',
         	  	child: 'gaga'
         	  },
      	  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']
      	  }
      	});
        
      });
       
       
      win1.add(createContact);
      win1.open();
      
      

      4. Build to iOS8 device / sim
      5. Receive above error.
      6. Remove relatedNames property.
      7. Build to IOS8 device / sim.
      8. Create Contacts works successfully.

      Result:

      Create Contacts will crash and return aforementioned error on iOS8.

      Expected Result:

      Create contacts should work successfully on iOS8, or return a warning to exclude the relatedName property when building for iOS8.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cng Chee Kiat Ng (Inactive)
                Reporter:
                htbryant Harry Bryant
                Reviewer:
                Hans Knöchel
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration