So I've been working on getting my app ready for iOS 4 and iPhone 4. Installed the latest Xcode and SDK and have been tweaking out graphics, etc. All is working flawlessly except I'm having problems running the app on the iPad simulator. I don't have an actual iPad to test.
My app uses an ABUnknownPersonViewController and it crashes when I tap "Create new contact", but WORKS FINE if I tap "Add to Existing Contact". Very strange!!
I get the following in the console when the app crashes:
2010-10-21 13:57:25.873 Copy2contact[58432:207] *** Assertion failure in -[ABPropertyGroup propertyModelControllerAtIndex:], /SourceCache/AddressBookUI_Sim/AddressBookUI-643.49/ABPropertyGroup.m:228
2010-10-21 13:57:25.875 Copy2contact[58432:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ''
2010-10-21 13:57:25.877 Copy2contact[58432:207] Stack: (
...
...
)
terminate called after throwing an instance of 'NSException'
This does not happen on the iPhone simulator or iPhone devices, just the iPad sim.
- Targeted device family: iPhone
- Base SDK: iOS Device 3.2
- Xcode 3.2.4
Here's how to build an example program to test:
Create a new Navigation-based iPhone project in Xcode
Add the AddressBook and AddressBookUI frameworks to the project
Add the following line to the top of RootViewController.m:
#import <AddressBookUI/ABUnknownPersonViewController.h>
Add the following to
viewDidLoad
in RootViewController.m:[super viewDidLoad];
ABRecordRef personRef = ABPersonCreate();
ABUnknownPersonViewController* abNew = [[ABUnknownPersonViewController alloc] init];
CFErrorRef err = nil; // Should be released if set? ABRecordSetValue(personRef, kABPersonFirstNameProperty, [NSString stringWithString:@"First"], &err) && ABRecordSetValue(personRef, kABPersonLastNameProperty, [NSString stringWithString:@"Last"], &err);
abNew.displayedPerson = personRef;
abNew.allowsActions = NO;
abNew.allowsAddingToAddressBook = YES;
[self.navigationController pushViewController:abNew animated:YES];
[abNew release];
CFRelease(personRef开发者_如何学Python);
I was able to get an iPad to test on and have verified that this only occurs in the simulator. I opened bug 8596499
精彩评论