Description
When attempting to access certain information of a contact the app crashes and the below is output in the console, the file attached as crash.txt shows the crash log given. It is the same for all crashes.
The information that crashes the application is as follows
* Anything related to birthday, including Islam, Hebrew and Chinese
* Any social profile including
** Twitter
** Facebook
** Flickr
** LinkedIn
** Myspace
** Sina Weibo
* Ringtone
* Game Center
*Notes*
The *native behavior* when accessing these through the *Apple contacts app* is that they all open external applications such as
* any social media opens the web browser
* birthdays open the calendar
* ringtone opens a menu to change the ringtone
When selecting Anniversary the app does not crash and simply returns the date, it is only for information pertaining to birthdays that the app crashes on. This was fixed in TIMOB-18359
When the app is asked to return any information stored in the 'instant message' section it returns it in the format as below
{
service = <instant message service>
username = <instant message username>;
}
for example
{
service = AIM;
username = Bob;
}
*STUDIO CONSOLE LOG*
[ERROR] : The application has crashed with an uncaught exception 'NSRangeException'.
[ERROR] : Reason:
[ERROR] : *** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x0000000184842084 <redacted> + 132
[ERROR] : 1 libobjc.A.dylib 0x0000000194e200e4 objc_exception_throw + 60
[ERROR] : 2 CoreFoundation 0x0000000184727ec4 CFRunLoopRemoveTimer + 0
[ERROR] : 3 KitchenSink 0x00000001001e1010 KitchenSink + 1314832
[ERROR] : 4 KitchenSink 0x00000001001e141c KitchenSink + 1315868
[ERROR] : 5 AddressBookUI 0x0000000183a4f3a0 <redacted> + 276
[ERROR] : 6 AddressBookUI 0x0000000183aff2d4 <redacted> + 412
[ERROR] : 7 AddressBookUI 0x0000000183aff7cc <redacted> + 72
[ERROR] : 8 libdispatch.dylib 0x000000019546549c <redacted> + 24
[ERROR] : 9 libdispatch.dylib 0x000000019546545c <redacted> + 16
[ERROR] : 10 libdispatch.dylib 0x0000000195469a70 _dispatch_main_queue_callback_4CF + 932
[ERROR] : 11 CoreFoundation 0x00000001847f98dc <redacted> + 12
[ERROR] : 12 CoreFoundation 0x00000001847f7984 <redacted> + 1492
[ERROR] : 13 CoreFoundation 0x0000000184725664 CFRunLoopRunSpecific + 396
[ERROR] : 14 GraphicsServices 0x000000018d8675a4 GSEventRunModal + 168
[ERROR] : 15 UIKit 0x000000018902a4f8 UIApplicationMain + 1488
[ERROR] : 16 KitchenSink 0x00000001000a6e60 KitchenSink + 28256
[ERROR] : 17 libdyld.dylib 0x000000019548ea08 <redacted> + 4
[ERROR] : *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
[ERROR] : *** First throw call stack:
[ERROR] : (0x184842084 0x194e200e4 0x184727ec4 0x1001e1010 0x1001e141c 0x183a4f3a0 0x183aff2d4 0x183aff7cc 0x19546549c 0x19546545c 0x195469a70 0x1847f98dc 0x1847f7984 0x184725664 0x18d8675a4 0x18902a4f8 0x1000a6e60 0x19548ea08)
Steps To Reproduce
1. Install KitchenSink to a device
2. Navigate to Phone->Contacts->Contacts Picker
3. Ensure that 'Stop on property' is enabled
4.. Find a contact with any of the above
Actual Result
When selecting these the app will crash
Expected Result
The app should not crash, the external applications should open (*in parity with native behaviour*) *or* the data should be displayed as normal (*in parity with Titanium existing behavior*)
STEPS TO TEST:
- Create a simple classic project. - Update project with test code - Run on iOS device/simulator (iOS 8) - press 'request access' to get permission to access and edit contacts - press 'insert contact' to insert a new contact 'John Deep' - press 'open contact' to open the contact picker - choose the newly added contact 'John Deep' - press 'birthday'EXPECTED RESULT:
{quote}birthday appears in label as a string{quote} - repeat to 'open contact' - choose 'John Deep' - press one of the social profilesEXPECTED RESULT:
{quote}corresponding social profile information appears in label{quote} - repeat to 'open contact' - choose 'John Deep' - press the alternate birthdayEXPECTED RESULT:
{quote}corresponding alternative birthday information appears in label{quote} *Note* All returned results from the contact picker should be displayed as normal (in parity with Titanium existing behavior) Test should be repeated in iOS 7, 'birthday', 'social profiles' should work, while 'alternate birthday' should not exist.PR here: https://github.com/appcelerator/titanium_mobile/pull/6598
PR merged
Reopening ticket as I am still seeing crashes when accessing information related to birthdays when using the below: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502171827 Titanium SDK build: 4.0.0.v20150303161012 Titanium CLI, build: 3.5.0-dev Alloy: 1.5.1 Secondly, when using the test code provided, if you do the following then information is removed from the contact. 1. Using the attached test code build to an iOS 8 device. 2. Open the application and then request authorization if needed and then add a contact 3. Close the application and then open the iOS contacts application 4. Find John Deep, notice next to the Wifi icon that something is updating behind the scenes on iOS, this is the contacts on device syncing with I presume iCloud 5. Open John Deep before the the sync is complete and Chinese Birthday will exist 6. Open John Deep after the sync has been completed and the Chinese Birthday will no longer exist
[~eharris], Can you let me know which exact iOS version you are using? Surprisingly, I tried the test code today with my own iPhone which is iOS 8.1.3, setting either alternate birthday or social profile will not work. I'm not sure if it's an Apple bug but will continue to investigate.
[~cng] I tested using an iPhone 6 Plus running iOS 8.1.3, I will revisit tomorrow and try earlier 8.X devices as well as beta and see if there is any difference in the behavior.
Tested on simulator 8.1, device iOS 8.0 all working However, tested on my personal device running iOS 8.1.3, unable to add contacts parameters including alternate birthday and social profile. To investigate further.
Just found out why it wasn't working on my personal iPhone. Under settings -> Mail, Contacts, Calendars -> Contacts -> Default Account, it was set to Appcelerator, when it should be set to iCloud. This will result in 'ABAddressBookErrorDomain error 0' when creating a new person contact with socialProfile or alternate birthday parameters. On the test devices, this 'default account' was nonexistent. Will put a note wrt this in apidocs. [~eharris], Can you elaborate or reproduce the crashes? As for the 2nd case, I have tried to reproduce it, but my information stays permanent. I even logged into www.icloud.com to check and John Deep's info is persistent as well. Maybe you can check on the 'default account' i mentioned, and log into www.icloud.com to verify too.
[~eharris] looks like i found the crash when trying to read alternateBirthday or birthday. PR here: https://github.com/appcelerator/titanium_mobile/pull/6693 and merged. Think you can check it out again?
Backport to 4_0_X: https://github.com/appcelerator/titanium_mobile/pull/6694
Everything except selecting 'Ringtone' for the contacts works. If you choose 'Ringtone', the same crash noted in the ticket description is thrown. Titanium SDK 4.0.0.v20150306095010 Studio 4.0.0.201502171827 CLI 3.4.2 Xcode 6.2 On: iPhone 6, iOS 8.2 iPad Air 2, iOS 8.2
PR here: https://github.com/appcelerator/titanium_mobile/pull/6710 4_0_X PR here: https://github.com/appcelerator/titanium_mobile/pull/6711 Note: selecting RingTone or textTone will not crash the app after the fix. But the returned data only indicates the propertyName. Value is null, since Apple doesn't support the return of any value for these properties. Updated the sample code to include Ti.API.info on the returned data to see more information.
PR's merged
Verified fixed using: Titanium SDK 4.0.0.v20150311105810 Studio 4.0.0.201503062102 CLI 3.4.2 Xcode 6.2 Node 0.10.36 On: iPhone 6, iOS 8.2 iPad Air 2, iOS 8.2 No longer encounter crashes when accessing contact's properties.