diff options
Diffstat (limited to 'iPhone')
-rw-r--r-- | iPhone/GTMABAddressBook.h | 2 | ||||
-rw-r--r-- | iPhone/GTMABAddressBookTest.m | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/iPhone/GTMABAddressBook.h b/iPhone/GTMABAddressBook.h index 48e7f88..1a73545 100644 --- a/iPhone/GTMABAddressBook.h +++ b/iPhone/GTMABAddressBook.h @@ -26,6 +26,8 @@ // (GTMABAddressBook.strings). // // If things seem strange, it may be due to one of the following radars: +// 6240394 AddressBook framework constants not initialized until +// ABCreateAddressBook called // 6208390 Integer and real values don't work in ABMultiValueRefs // (and this isn't part of the title, but dictionaries don't work // either) diff --git a/iPhone/GTMABAddressBookTest.m b/iPhone/GTMABAddressBookTest.m index 56106a9..29f46a6 100644 --- a/iPhone/GTMABAddressBookTest.m +++ b/iPhone/GTMABAddressBookTest.m @@ -491,7 +491,7 @@ STAssertNotNULL(ref, nil); NSString *label = [[NSString alloc] initWithString:@"label"]; STAssertNotNil(label, nil); - id val; + id val = nil; switch (type) { case kABDictionaryPropertyType: val = [[NSDictionary alloc] initWithObjectsAndKeys:@"1", @"1", nil]; @@ -562,4 +562,24 @@ CFRelease(ref); } } + +// Globals used by testRadar6240394. +static ABPropertyID gGTMTestID; +static const ABPropertyID *gGTMTestIDPtr; + +void __attribute__((constructor))SetUpIDForTestRadar6240394(void) { + // These must be set up BEFORE ABAddressBookCreate is called. + gGTMTestID = kABPersonLastNameProperty; + gGTMTestIDPtr = &kABPersonLastNameProperty; +} + +- (void)testRadar6240394 { + // As of iPhone SDK 2.1, the property IDs aren't initialized until + // ABAddressBookCreate is actually called. They will return zero until + // then. Logged as radar 6240394. + STAssertEquals(gGTMTestID, 0, @"If this isn't zero, Apple has fixed 6240394"); + (void)ABAddressBookCreate(); + STAssertEquals(*gGTMTestIDPtr, kABPersonLastNameProperty, + @"If this doesn't work, something else has broken"); +} @end |