From 750b28c89618586a0450cacb86e28cd709374c9d Mon Sep 17 00:00:00 2001 From: "thomasvl@gmail.com" Date: Thu, 23 Oct 2008 20:52:34 +0000 Subject: - Update iphone address book radars. - Fix for issue 7 GTMABMutableMultiValue instantiation returns nil. --- iPhone/GTMABAddressBook.h | 9 ++++++++- iPhone/GTMABAddressBook.m | 2 +- iPhone/GTMABAddressBookTest.m | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'iPhone') diff --git a/iPhone/GTMABAddressBook.h b/iPhone/GTMABAddressBook.h index 1a73545..cdcfa7c 100644 --- a/iPhone/GTMABAddressBook.h +++ b/iPhone/GTMABAddressBook.h @@ -28,10 +28,12 @@ // If things seem strange, it may be due to one of the following radars: // 6240394 AddressBook framework constants not initialized until // ABCreateAddressBook called +// -- CLOSED as designed // 6208390 Integer and real values don't work in ABMultiValueRefs // (and this isn't part of the title, but dictionaries don't work // either) // 6207605 RecordIDs for people and groups are not unique in AddressBook +// -- CLOSED as designed // 6204021 kABGroupNameProperty and kABPersonFirstNameProperty have the same // value // 6203982 ABPersonCopyLocalizedPropertyName returns name for @@ -39,18 +41,23 @@ // 6203961 ABPersonGetTypeOfProperty returns a type for kABGroupNameProperty // 6203854 ABMultiValues hash to their address // 6203836 ABRecords hash to their address +// -- CLOSED behaves correctly // 6203606 Need CFTypeIDs for AddressBook CFTypes // 6202868 ABPersonSetImageData should validate image data // 6202860 Passing nil person into ABGroupAddMember crashes +// -- CLOSED behaves correctly // 6202827 Passing nil info ABMultiValueAddValueAndLabel causes crash +// -- CLOSED behaves correctly // 6202807 ABMultiValueInsertValueAndLabelAtIndex allows you to insert values // past end // 6201276 Removing a NULL record using ABAddressBookRemoveRecord crashes +// -- CLOSED behaves correctly // 6201258 Adding a NULL record using ABAddressBookAddRecord crashes +// -- CLOSED behaves correctly // 6201046 ABRecordSetValue returns true even if you pass in a bad type for a // value -// 6201032 ABRecordSetValue return "true" even if you pass nil as a value // 6201005 ABRecordRemoveValue returns true for value that aren't in the record +// -- CLOSED behaves correctly // 6200703 ABAddressBookAddRecord doesn't add an item to the people array until // it's saved // 6200638 ABAddressBookHasUnsavedChanges doesn't work diff --git a/iPhone/GTMABAddressBook.m b/iPhone/GTMABAddressBook.m index c06b511..05a5523 100644 --- a/iPhone/GTMABAddressBook.m +++ b/iPhone/GTMABAddressBook.m @@ -674,7 +674,7 @@ typedef struct { - (id)initWithPropertyType:(ABPropertyType)type { ABMutableMultiValueRef ref = nil; - if (!(type & kABMultiValueMask) && (type != kABInvalidPropertyType)) { + if (type != kABInvalidPropertyType) { ref = ABMultiValueCreateMutable(type); } self = [super initWithMultiValue:ref]; diff --git a/iPhone/GTMABAddressBookTest.m b/iPhone/GTMABAddressBookTest.m index 29f46a6..17a3096 100644 --- a/iPhone/GTMABAddressBookTest.m +++ b/iPhone/GTMABAddressBookTest.m @@ -356,6 +356,29 @@ = [[[GTMABMutableMultiValue alloc] initWithMultiValue:nil] autorelease]; STAssertNil(mutValue, nil); + const ABPropertyType types[] = { + kABStringPropertyType, + kABIntegerPropertyType, + kABRealPropertyType, + kABDateTimePropertyType, + kABDictionaryPropertyType, + kABMultiStringPropertyType, + kABMultiIntegerPropertyType, + kABMultiRealPropertyType, + kABMultiDateTimePropertyType, + kABMultiDictionaryPropertyType + }; + for (size_t i = 0; i < sizeof(types) / sizeof(ABPropertyType); ++i) { + mutValue = [GTMABMutableMultiValue valueWithPropertyType:types[i]]; + STAssertNotNil(mutValue, nil); + // Oddly the Apple APIs allow you to create a mutable multi value with + // either a property type of kABFooPropertyType or kABMultiFooPropertyType + // and apparently you get back basically the same thing. However if you + // ask a type that you created with kABMultiFooPropertyType for it's type + // it returns just kABFooPropertyType. + STAssertEquals([mutValue propertyType], + types[i] & ~kABMultiValueMask, nil); + } mutValue = [GTMABMutableMultiValue valueWithPropertyType:kABStringPropertyType]; STAssertNotNil(mutValue, nil); value = [[mutValue copy] autorelease]; -- cgit v1.2.3