Titanium JIRA Archive
Appcelerator Community (AC)

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

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-06-07T19:26:42.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsAppcelerator CLI, Appcelerator Modules, Titanium SDK & CLI
Labelsios
ReporterYaovi Kwasi
AssigneeShak Hossain
Created2016-05-23T15:45:50.000+0000
Updated2016-06-07T19:26:42.000+0000

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 {color:#d04437}[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 + 116 [ERROR] : 1 CoreFoundation 0x00000001836b14dc + 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 + 24 [ERROR] : 8 libdispatch.dylib 0x00000001831c547c + 16 [ERROR] : 9 libdispatch.dylib 0x00000001831cab84 _dispatch_main_queue_callback_4CF + 1844 [ERROR] : 10 CoreFoundation 0x0000000183730d50 + 12 [ERROR] : 11 CoreFoundation 0x000000018372ebb8 + 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 + 4 [ERROR] : ){color} {color:#d04437}[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] : }{color}

Attachments

FileDateSize
IMG_4620.PNG2016-05-23T15:45:18.000+000078779

Comments

  1. Hans Knöchel 2016-05-28

    [~cng] That looks very familiar to earlier contacts issues we had.
  2. Chee Kiat Ng 2016-05-30

JSON Source