Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-3649

iOS: Getting Custom fields for phone, address and email from Ti.Contacts.getAllPeople() throws error screen

    Details

      Description

      The Error below occurs for certain contacts in the contact list . This throw a red error screen on the device. But no error in the simulator. The app runs fine in the simulator but with warnings. But it breaks on the device. I have not seen this error on a device running iOS8, but any device running iOS 9 and above is breaking.
      ------------------------------------------------------------------

      var singleValue = [ 'firstName', 'middleName', 'lastName', 'fullName', 'prefix', 'suffix', 
                'nickname', 'firstPhonetic', 'middlePhonetic', 'lastPhonetic', 'organization', 
                'jobTitle', 'department', 'note', 
                'birthday', 
                'created', 
                'modified', 
                'kind'
              ];
      var multiValue = [
            'email', 'address', 'phone', 'instantMessage', 'relatedNames', 'date', 'url'
          ];
      function getAllContacts(){
       var people = Ti.Contacts.getAllPeople();
      var rawCollection = [];
      	for (var i=0, ilen=people.length; i<ilen; i++){
      		var data = {};
      	  	var person = people[i];
      		for (var j=0, jlen=singleValue.length; j<jlen; j++){
      			if(singleValue[j]){
      				data[singleValue[j]] = person[singleValue[j]];
      			}
      		}
      		for (var j=0, jlen=multiValue.length; j<jlen; j++){
      			if(multiValue[j]){
      				data[multiValue[j]] = person[multiValue[j]];
      			}
      		}
      		rawCollection.push(data);
      	}
      	return rawCollection;
      }
      

      -------------------------------------------------------------------------------------------------------
      LOGS

      [ERROR] : Script Error { [ERROR] : column = 759; [ERROR] : line = 1; [ERROR] : message = "*** -[NSPlaceholderString initWithString:]: nil argument"; [ERROR] : sourceURL = "file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js"; [ERROR] : stack = "t@file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js:1:759\nselectedPerson@file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js:1:2665"; [ERROR] : }
      [ERROR] : ErrorController is up. ABORTING open
      [ERROR] : *** -[__NSCFCalendar dateFromComponents:]: components cannot be nil
      [ERROR] : Future exception.
      [ERROR] : A few of these errors are going to be reported with this complaint, then further violations will simply be ignored.
      [ERROR] : Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
      [ERROR] : (
      [ERROR] : 0 CoreFoundation 0x00000001836b15c8 <redacted> + 116
      [ERROR] : 1 CoreFoundation 0x00000001836b14dc <redacted> + 76
      [ERROR] : 2 MiabeApp 0x0000000100148b54 MiabeApp + 691028
      [ERROR] : 3 MiabeApp 0x00000001001493fc MiabeApp + 693244
      [ERROR] : 4 MiabeApp 0x000000010015ffb0 MiabeApp + 786352
      [ERROR] : 5 MiabeApp 0x00000001001603b4 MiabeApp + 787380
      [ERROR] : 6 MiabeApp 0x00000001001601bc MiabeApp + 786876
      [ERROR] : 7 libdispatch.dylib 0x00000001831c54bc <redacted> + 24
      [ERROR] : 8 libdispatch.dylib 0x00000001831c547c <redacted> + 16
      [ERROR] : 9 libdispatch.dylib 0x00000001831cab84 _dispatch_main_queue_callback_4CF + 1844
      [ERROR] : 10 CoreFoundation 0x0000000183730d50 <redacted> + 12
      [ERROR] : 11 CoreFoundation 0x000000018372ebb8 <redacted> + 1628
      [ERROR] : 12 CoreFoundation 0x0000000183658c50 CFRunLoopRunSpecific + 384
      [ERROR] : 13 GraphicsServices 0x0000000184f40088 GSEventRunModal + 180
      [ERROR] : 14 UIKit 0x0000000188942088 UIApplicationMain + 204
      [ERROR] : 15 MiabeApp 0x00000001000a84b4 MiabeApp + 33972
      [ERROR] : 16 libdyld.dylib 0x00000001831f68b8 <redacted> + 4
      [ERROR] : )

      [ERROR] : Script Error { [ERROR] : column = 759; [ERROR] : line = 1; [ERROR] : message = "*** -[NSPlaceholderString initWithString:]: nil argument"; [ERROR] : sourceURL = "file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js"; [ERROR] : stack = "t@file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js:1:759\nselectedPerson@file:///var/containers/Bundle/Application/76E58298-EFAD-4F5E-A4BC-3E70E2BF6611/MiabeApp.app/alloy/controllers/mycode/index.js:1:2665"; [ERROR] : }

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              yaovik Yaovi Kwasi
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code