CALayerInvalidGeometry uncaught exception in AddressBookUI

Originator:futuretap
Number:rdar://8828308 Date Originated:06-Jan-2011 05:38 PM
Status:Closed Resolved:
Product:iPhone SDK Product Version:4.2
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
We received several crash reports with

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [0 nan]'

originating from the AddressBookUI framework. Please see the crash reports attached.
While we were not able to reproduce this particular backtrace, we created a little test project with an ABPeoplePickerNavigationController that crashes *in the simulator* reproducibly with

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan -0.5]'

We were NOT able to reproduce the crash on our test devices (iPhone 4 running iOS 4.1 and iPhone 3GS running iOS 4.2.1). However, this might be due to specific circumstances not met on our devices.


Steps to Reproduce:
- Reset the simulator content (to make sure we have a sane AddressBook)
- Create 2 contacts using "Contacts": one with just a name, one with name and an address
- Build the attached test project and run it in the simulator.
- Tap the "Address Book" button
- Select the contact with address
- Go back
- Select the contact without address

Expected Results:
The contact without address should be shown.

Actual Results:
The app crashes. Crash report "ABPersonVCBug.crash" attached.

Regression:
Happens in the simulator on iOS 4.0.2, 4.1 and 4.2. Not reproducible on our test devices.

Comments

A workaround for me was to be add kABPersonFirstNameProperty, kABPersonLastNameProperty and kABPersonOrganisationProperty to the list of displayed properties:

ABPeoplePickerNavigationController *picker = [[[ABPeoplePickerNavigationController alloc] init] autorelease];
NSMutableArray* properties = [NSMutableArray array];
[properties addObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
//Needed to stop mysterious crash if no number is present in contact and it is selected a second time rdar://8828308
[properties addObject:[NSNumber numberWithInt:kABPersonFirstNameProperty]];
[properties addObject:[NSNumber numberWithInt:kABPersonLastNameProperty]];
[properties addObject:[NSNumber numberWithInt:kABPersonOrganizationProperty]];
picker.displayedProperties = properties;

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!