From 3fe8540dfce1c292494f31e9edaf17dcad2a18ee Mon Sep 17 00:00:00 2001 From: Dave MacLachlan Date: Tue, 4 Sep 2018 12:41:29 -0700 Subject: Remove deprecated Address Book support from GTM --- AddressBook/GTMABAddressBook.h | 425 ------------ AddressBook/GTMABAddressBook.m | 1234 ---------------------------------- AddressBook/GTMABAddressBook.strings | 22 - AddressBook/GTMABAddressBookTest.m | 713 -------------------- AddressBook/TestData/phone.png | Bin 3242 -> 0 bytes GTM.xcodeproj/project.pbxproj | 141 ---- GTMiPhone.xcodeproj/project.pbxproj | 42 -- 7 files changed, 2577 deletions(-) delete mode 100644 AddressBook/GTMABAddressBook.h delete mode 100644 AddressBook/GTMABAddressBook.m delete mode 100644 AddressBook/GTMABAddressBook.strings delete mode 100644 AddressBook/GTMABAddressBookTest.m delete mode 100644 AddressBook/TestData/phone.png diff --git a/AddressBook/GTMABAddressBook.h b/AddressBook/GTMABAddressBook.h deleted file mode 100644 index 7ef250d..0000000 --- a/AddressBook/GTMABAddressBook.h +++ /dev/null @@ -1,425 +0,0 @@ -// -// GTMABAddressBook.h -// -// Copyright 2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// These classes wrap up the iPhone AddressBook 'C' API in a manner very -// similar to that found on Mac OS X. They differ only in that none of these -// routines throws, and some of the types are different as necessitated by -// the APIs that they wrap. These wrappers also protect you from a number -// of issues in the AddressBook API (as of iPhone SDK 2.0/2.1) -// -// Note that there is a strings file that you may want to localize -// (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 -// -- 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 -// kABGroupNameProperty -// 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 -// 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 -// -- CLOSED fixed in iOS 3.2 - -#import "GTMDefines.h" -#import - -#if GTM_IPHONE_SDK -#import -@class UIImage; -#else // GTM_IPHONE_SDK -#import -#import -@class NSImage; -#endif // GTM_IPHONE_SDK - -@class GTMABPerson; -@class GTMABGroup; -@class GTMABRecord; - -GTM_EXTERN NSString *const kGTMABUnknownPropertyName; - -#if GTM_IPHONE_SDK - -@class UIImage; -typedef ABRecordID GTMABRecordID; -typedef ABPropertyID GTMABPropertyID; -typedef UIImage GTMABImage; -typedef ABPersonCompositeNameFormat GTMABPersonCompositeNameFormat; -typedef ABMultiValueIdentifier GTMABMultiValueIdentifier; - enum _GTMABPropertyType { - kGTMABInvalidPropertyType = kABInvalidPropertyType, - kGTMABStringPropertyType = kABStringPropertyType, - kGTMABIntegerPropertyType = kABIntegerPropertyType, - kGTMABRealPropertyType = kABRealPropertyType, - kGTMABDateTimePropertyType = kABDateTimePropertyType, - kGTMABDictionaryPropertyType = kABDictionaryPropertyType, - kGTMABMultiStringPropertyType = kABMultiStringPropertyType, - kGTMABMultiIntegerPropertyType = kABMultiIntegerPropertyType, - kGTMABMultiRealPropertyType = kABMultiRealPropertyType, - kGTMABMultiDateTimePropertyType = kABMultiDateTimePropertyType, - kGTMABMultiDictionaryPropertyType = kABMultiDictionaryPropertyType, -}; -typedef ABPropertyType GTMABPropertyType; -#define kGTMABPersonFirstNameProperty kABPersonFirstNameProperty -#define kGTMABPersonLastNameProperty kABPersonLastNameProperty -#define kGTMABPersonBirthdayProperty kABPersonBirthdayProperty -#define kGTMABPersonPhoneProperty kABPersonPhoneProperty -#define kGTMABGroupNameProperty kABGroupNameProperty - -#define kGTMABPersonPhoneMainLabel ((NSString *)kABPersonPhoneMainLabel) -#define kGTMABPersonPhoneMobileLabel ((NSString *)kABPersonPhoneMobileLabel) -#define kGTMABPersonPhoneHomeLabel ((NSString *)kABHomeLabel) -#define kGTMABPersonPhoneWorkLabel ((NSString *)kABWorkLabel) -#define kGTMABPersonPhoneWorkFaxLabel ((NSString *)kABPersonPhoneWorkFAXLabel) -#define kGTMABPersonPhoneHomeFaxLabel ((NSString *)kABPersonPhoneHomeFAXLabel) -#define kGTMABPersonPhonePagerLabel ((NSString *)kABPersonPhonePagerLabel) - -#define kGTMABOtherLabel ((NSString *)kABOtherLabel) - -#define kGTMABMultiValueInvalidIdentifier kABMultiValueInvalidIdentifier -#define kGTMABRecordInvalidID kABRecordInvalidID - -#else // GTM_IPHONE_SDK - -@class NSImage; -typedef NSString* GTMABRecordID; -typedef NSString* GTMABPropertyID; -typedef NSString* GTMABMultiValueIdentifier; -typedef NSImage GTMABImage; -typedef uint32_t GTMABPersonCompositeNameFormat; -enum { - kABPersonCompositeNameFormatFirstNameFirst = 0, - kABPersonCompositeNameFormatLastNameFirst = 1 -}; -enum _GTMABPropertyType { - kGTMABInvalidPropertyType = kABErrorInProperty, - kGTMABStringPropertyType = kABStringProperty, - kGTMABIntegerPropertyType = kABIntegerProperty, - kGTMABRealPropertyType = kABRealProperty, - kGTMABDateTimePropertyType = kABDateProperty, - kGTMABDictionaryPropertyType = kABDictionaryProperty, - kGTMABMultiStringPropertyType = kABMultiStringProperty, - kGTMABMultiIntegerPropertyType = kABMultiIntegerProperty, - kGTMABMultiRealPropertyType = kABMultiRealProperty, - kGTMABMultiDateTimePropertyType = kABMultiDateProperty, - kGTMABMultiDictionaryPropertyType = kABMultiDictionaryProperty, -}; -typedef CFIndex GTMABPropertyType; -#define kGTMABPersonFirstNameProperty kABFirstNameProperty -#define kGTMABPersonLastNameProperty kABLastNameProperty -#define kGTMABPersonBirthdayProperty kABBirthdayProperty -#define kGTMABPersonPhoneProperty kABPhoneProperty -#define kGTMABGroupNameProperty kABGroupNameProperty - -#define kGTMABPersonPhoneMainLabel kABPhoneMainLabel -#define kGTMABPersonPhoneMobileLabel kABPhoneMobileLabel -#define kGTMABPersonPhoneHomeLabel kABPhoneHomeLabel -#define kGTMABPersonPhoneWorkLabel kABPhoneWorkLabel -#define kGTMABPersonPhoneWorkFaxLabel kABPhoneWorkFAXLabel -#define kGTMABPersonPhoneHomeFaxLabel kABPhoneHomeFAXLabel -#define kGTMABPersonPhonePagerLabel kABPhonePagerLabel - -#define kGTMABOtherLabel kABOtherLabel - -#define kGTMABMultiValueInvalidIdentifier @"ABMultiValueInvalidIdentifier" -#define kGTMABRecordInvalidID @"ABRecordInvalidID" -extern NSString* const kABPersonRecordType; -extern NSString* const kABGroupRecordType; - -#endif // GTM_IPHONE_SDK - -// Wrapper for an AddressBook on iPhone -@interface GTMABAddressBook : NSObject { - @private - ABAddressBookRef addressBook_; -} - -// Returns a new instance of an address book. -+ (GTMABAddressBook *)addressBook; - -// Return the address book reference -- (ABAddressBookRef)addressBookRef; - -// Saves changes made since the last save -// Return YES if successful (or there was no change) -- (BOOL)save; - -// Returns YES if there are unsaved changes -// The unsaved changes flag is automatically set when changes are made -// As of iPhone 2.1, this does not work, and will always return NO. -// Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work -- (BOOL)hasUnsavedChanges; - -// Returns a GTMABPerson matching an ID -// Returns nil if the record could not be found -- (GTMABPerson *)personForId:(GTMABRecordID)uniqueId; - -// Returns a GTMABGroup matching an ID -// Returns nil if the record could not be found -- (GTMABGroup *)groupForId:(GTMABRecordID)uniqueId; - -// Adds a record (ABPerson or ABGroup) to the AddressBook database -// Be sure to read notes for -people and -group. -- (BOOL)addRecord:(GTMABRecord *)record; - -// Removes a record (ABPerson or ABGroup) from the AddressBook database -- (BOOL)removeRecord:(GTMABRecord *)record; - -// Returns an array (GTMABPerson) of all the people in the AddressBook database -// As of iPhone 2.1, this array will not contain new entries until you save -// the address book. -// Radar 6200703: ABAddressBookAddRecord doesn't add an item to the people array -// until it's saved -- (NSArray *)people; - -// Returns an array of all the groups (GTMABGroup) in the AddressBook database -// As of iPhone 2.1, this array will not contain new entries until you save -// the address book. -// Radar 6200703: ABAddressBookAddRecord doesn't add an item to the people array -// until it's saved -- (NSArray *)groups; - -// Performs a prefix search on the composite names of people in an address book -// and returns an array of persons that match the search criteria. -// Ignores case. -- (NSArray *)peopleWithCompositeNameWithPrefix:(NSString *)prefix; - -// Performs a prefix search on the composite names of groups in an address book -// and returns an array of groups that match the search criteria. -// Ignores case. -- (NSArray *)groupsWithCompositeNameWithPrefix:(NSString *)prefix; - -// Returns a localized name for a given label -+ (NSString *)localizedLabel:(NSString *)label; - -@end - -// Wrapper for a ABRecord on iPhone. -// A abstract class. Instantiate one of the concrete subclasses, GTMABPerson or -// GTMABGroup. -@interface GTMABRecord : NSObject { - @private - ABRecordRef record_; -} - -// Create a record with a recordRef. -// Since GTMABRecord is an abstract base class, attempting to create one -// of these directly will throw an exception. Use with one of the concrete -// subclasses. -+ (id)recordWithRecord:(ABRecordRef)record; - -// Designated initializer -// Since GTMABRecord is an abstract base class, attempting to create one -// of these directly will throw an exception. Use with one of the concrete -// subclasses. -- (id)initWithRecord:(ABRecordRef)record; - -// Return our recordRef -- (ABRecordRef)recordRef; - -// Return the recordID for the record -- (GTMABRecordID)recordID; - -// Returns the value of a given property. -// The type of the value depends on the property type. -- (id)valueForProperty:(GTMABPropertyID)property; - -// Set the value of a given property. -// The type of the value must match the property type. -// Returns YES if value set properly -- (BOOL)setValue:(id)value forProperty:(GTMABPropertyID)property; - -// Removes the value for the property -// Returns yes if value removed -- (BOOL)removeValueForProperty:(GTMABPropertyID)property; - -// returns a human friendly name for the record -- (NSString *)compositeName; - -// returns the type of a property -+ (GTMABPropertyType)typeOfProperty:(GTMABPropertyID)property; - -// returns a human friendly localized name for a property -+ (NSString *)localizedPropertyName:(GTMABPropertyID)property; -@end - -// Wrapper for an ABPerson on iPhone -@interface GTMABPerson : GTMABRecord - -// Creates a person with a first name and a last name. -+ (GTMABPerson *)personWithFirstName:(NSString *)first - lastName:(NSString *)last; - -// Sets image data for a person. Data must be to a block of data that -// will create a valid GTMABImage. -- (BOOL)setImageData:(NSData *)data; - -// Returns the image data. -- (NSData *)imageData; - -// Returns the image for a person -- (GTMABImage *)image; - -// Sets a the image for a person -- (BOOL)setImage:(GTMABImage *)image; - -// Returns the format in with names are composited -+ (GTMABPersonCompositeNameFormat)compositeNameFormat; -@end - -// Wrapper for a ABGroup on iPhone -@interface GTMABGroup : GTMABRecord -// Create a new group named |name| -+ (GTMABGroup *)groupNamed:(NSString *)name; - -// Return an array of members (GTMABPerson) -- (NSArray *)members; - -// Add a member to a group -- (BOOL)addMember:(GTMABPerson *)person; - -// Remove a member from a group -- (BOOL)removeMember:(GTMABPerson *)person; -@end - -// GTMABMultiValue does not support NSFastEnumeration because in -// the Apple frameworks it returns identifiers which are already NSStrings. -// In our case identifiers aren't NS types, and it doesn't make sense -// to convert them to NSNumbers just to convert them back so you can -// actually get at the values and labels. -// Instead we supply valueEnumerator and labelEnumerator which you can -// fast enumerate on to get values and labels directly. -@interface GTMABMultiValue : NSObject { - @protected - ABMultiValueRef multiValue_; -} - -// Create a multi value -- (id)initWithMultiValue:(ABMultiValueRef)multiValue; - -// return it's ref -- (ABMultiValueRef)multiValueRef; - -// Returns the number of value/label pairs -- (NSUInteger)count; - -// Returns a value at a given index -// Returns nil if index is out of bounds -- (id)valueAtIndex:(NSUInteger)idx; - -// Returns a label at a given index -// Returns nil if index is out of bounds -- (NSString *)labelAtIndex:(NSUInteger)idx; - -// Returns an identifier at a given index -// Returns kABMultiValueInvalidIdentifier if index is out of bounds -- (GTMABMultiValueIdentifier)identifierAtIndex:(NSUInteger)idx; - -// Returns the index of a given identifier -// Returns NSNotFound if not found -- (NSUInteger)indexForIdentifier:(GTMABMultiValueIdentifier)identifier; - -// Type of the contents of this multivalue -- (GTMABPropertyType)propertyType; - -// Returns the value for a given identifier -// Returns nil if the identifier is not found -- (id)valueForIdentifier:(GTMABMultiValueIdentifier)identifier; - -// Returns the value for a given identifier -// Returns nil if the identifier is not found -- (NSString *)labelForIdentifier:(GTMABMultiValueIdentifier)identifier; - -// Returns an enumerator for enumerating through values -- (NSEnumerator *)valueEnumerator; - -// Returns an enumerator for enumerating through labels -- (NSEnumerator *)labelEnumerator; - -@end - -@interface GTMABMutableMultiValue : GTMABMultiValue { - @private - // Use unsigned long here instead of NSUInteger because that's what - // NSFastEnumeration Protocol wants currently (iPhone 2.1) - unsigned long mutations_; -} - -// Create a new mutable multivalue with a given type -+ (id)valueWithPropertyType:(GTMABPropertyType)type; - -// Create a new mutable multivalue with a given type -- (id)initWithPropertyType:(GTMABPropertyType)type; - -// Create a new mutable multivalue based on |multiValue| -- (id)initWithMutableMultiValue:(ABMutableMultiValueRef)multiValue; - -// Adds a value with its label -// Returns the identifier if successful, kABMultiValueInvalidIdentifier -// otherwise. -- (GTMABMultiValueIdentifier)addValue:(id)value withLabel:(CFStringRef)label; - -// Insert a value/label pair at a given index -// Returns the identifier if successful. kABMultiValueInvalidIdentifier -// otherwise -// If index is out of bounds, returns kABMultiValueInvalidIdentifier. -- (GTMABMultiValueIdentifier)insertValue:(id)value - withLabel:(CFStringRef)label - atIndex:(NSUInteger)index; - -// Removes a value/label pair at a given index -// Returns NO if index out of bounds -- (BOOL)removeValueAndLabelAtIndex:(NSUInteger)index; - -// Replaces a value at a given index -// Returns NO if index out of bounds -- (BOOL)replaceValueAtIndex:(NSUInteger)index withValue:(id)value; - -// Replaces a label at a given index -// Returns NO if index out of bounds -- (BOOL)replaceLabelAtIndex:(NSUInteger)index withLabel:(CFStringRef)label; - -@end diff --git a/AddressBook/GTMABAddressBook.m b/AddressBook/GTMABAddressBook.m deleted file mode 100644 index 9fce8ff..0000000 --- a/AddressBook/GTMABAddressBook.m +++ /dev/null @@ -1,1234 +0,0 @@ -// -// GTMABAddressBook.m -// -// Copyright 2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -#import "GTMABAddressBook.h" -#import "GTMTypeCasting.h" - -#if GTM_IPHONE_SDK -#import -#else // GTM_IPHONE_SDK -#import -#endif // GTM_IPHONE_SDK - -NSString *const kGTMABUnknownPropertyName = @"UNKNOWN_PROPERTY"; - -typedef struct { - GTMABPropertyType pType; - Class class; -} TypeClassNameMap; - -@interface GTMABMultiValue () -- (unsigned long*)mutations; -@end - -@interface GTMABMutableMultiValue () -// Checks to see if a value is a valid type to be stored in this multivalue -- (BOOL)checkValueType:(id)value; -@end - -@interface GTMABMultiValueEnumerator : NSEnumerator { - @private - ABMultiValueRef ref_; // ref_ cached from enumeree_ - GTMABMultiValue *enumeree_; - unsigned long mutations_; - NSUInteger count_; - NSUInteger index_; - BOOL useLabels_; -} -+ (id)valueEnumeratorFor:(GTMABMultiValue*)enumeree; -+ (id)labelEnumeratorFor:(GTMABMultiValue*)enumeree; -- (id)initWithEnumeree:(GTMABMultiValue*)enumeree useLabels:(BOOL)useLabels; -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - objects:(id *)stackbuf - count:(NSUInteger)len; -@end - -@implementation GTMABAddressBook -+ (GTMABAddressBook *)addressBook { - return [[[self alloc] init] autorelease]; -} - -- (id)init { - if ((self = [super init])) { -#if GTM_IPHONE_SDK - CFErrorRef error = nil; - addressBook_ = ABAddressBookCreateWithOptions(NULL, &error); - if (error) { - _GTMDevLog(@"ABAddressBookCreate: %@", error); - CFRelease(error); - } -#else // GTM_IPHONE_SDK - addressBook_ = ABGetSharedAddressBook(); - CFRetain(addressBook_); -#endif // GTM_IPHONE_SDK - if (!addressBook_) { - // COV_NF_START - [self release]; - self = nil; - // COV_NF_END - } - } - return self; -} - -- (void)dealloc { - if (addressBook_) { - CFRelease(addressBook_); - } - [super dealloc]; -} - -- (BOOL)save { -#if GTM_IPHONE_SDK - CFErrorRef cfError = NULL; - bool wasGood = ABAddressBookSave(addressBook_, &cfError); - if (!wasGood) { - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - if (cfError) { - CFRelease(cfError); - } - } -#else // GTM_IPHONE_SDK - bool wasGood = ABSave(addressBook_); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (BOOL)hasUnsavedChanges { - bool hasUnsavedChanges; -#if GTM_IPHONE_SDK - hasUnsavedChanges = ABAddressBookHasUnsavedChanges(addressBook_); -#else // GTM_IPHONE_SDK - hasUnsavedChanges = ABHasUnsavedChanges(addressBook_); -#endif // GTM_IPHONE_SDK - return hasUnsavedChanges ? YES : NO; -} - -- (BOOL)addRecord:(GTMABRecord *)record { - // Note: we check for bad data here because of radar - // 6201258 Adding a NULL record using ABAddressBookAddRecord crashes - if (!record) return NO; -#if GTM_IPHONE_SDK - CFErrorRef cfError = NULL; - bool wasGood = ABAddressBookAddRecord(addressBook_, - [record recordRef], &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - bool wasGood = ABAddRecord(addressBook_, [record recordRef]); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (BOOL)removeRecord:(GTMABRecord *)record { - // Note: we check for bad data here because of radar - // 6201276 Removing a NULL record using ABAddressBookRemoveRecord crashes - if (!record) return NO; -#if GTM_IPHONE_SDK - CFErrorRef cfError = NULL; - bool wasGood = ABAddressBookRemoveRecord(addressBook_, - [record recordRef], &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - GTMABRecordID recID = [record recordID]; - ABRecordRef ref = ABCopyRecordForUniqueId(addressBook_, (CFStringRef)recID); - bool wasGood = NO; - if (ref) { - wasGood = ABRemoveRecord(addressBook_, [record recordRef]); - CFRelease(ref); - } -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (NSArray *)people { -#if GTM_IPHONE_SDK - NSArray *people - = GTMCFAutorelease(ABAddressBookCopyArrayOfAllPeople(addressBook_)); -#else // GTM_IPHONE_SDK - NSArray *people - = GTMCFAutorelease(ABCopyArrayOfAllPeople(addressBook_)); -#endif // GTM_IPHONE_SDK - NSMutableArray *result = [NSMutableArray arrayWithCapacity:[people count]]; - id person; - for (person in people) { - [result addObject:[GTMABPerson recordWithRecord:person]]; - } - return result; -} - -- (NSArray *)groups { -#if GTM_IPHONE_SDK - NSArray *groups - = GTMCFAutorelease(ABAddressBookCopyArrayOfAllGroups(addressBook_)); -#else // GTM_IPHONE_SDK - NSArray *groups - = GTMCFAutorelease(ABCopyArrayOfAllGroups(addressBook_)); -#endif // GTM_IPHONE_SDK - NSMutableArray *result = [NSMutableArray arrayWithCapacity:[groups count]]; - id group; - for (group in groups) { - [result addObject:[GTMABGroup recordWithRecord:group]]; - } - return result; -} - -- (ABAddressBookRef)addressBookRef { - return addressBook_; -} - -- (GTMABPerson *)personForId:(GTMABRecordID)uniqueId { - GTMABPerson *person = nil; -#if GTM_IPHONE_SDK - ABRecordRef ref = ABAddressBookGetPersonWithRecordID(addressBook_, uniqueId); -#else // GTM_IPHONE_SDK - ABRecordRef ref = ABCopyRecordForUniqueId(addressBook_, - (CFStringRef)uniqueId); -#endif // GTM_IPHONE_SDK - if (ref) { - person = [GTMABPerson recordWithRecord:ref]; - } - return person; -} - -- (GTMABGroup *)groupForId:(GTMABRecordID)uniqueId { - GTMABGroup *group = nil; -#if GTM_IPHONE_SDK - ABRecordRef ref = ABAddressBookGetGroupWithRecordID(addressBook_, uniqueId); -#else // GTM_IPHONE_SDK - ABRecordRef ref = ABCopyRecordForUniqueId(addressBook_, - (CFStringRef)uniqueId); -#endif // GTM_IPHONE_SDK - if (ref) { - group = [GTMABGroup recordWithRecord:ref]; - } - return group; -} - -// Performs a prefix search on the composite names of people in an address book -// and returns an array of persons that match the search criteria. -- (NSArray *)peopleWithCompositeNameWithPrefix:(NSString *)prefix { -#if GTM_IPHONE_SDK - NSArray *people = - GTMCFAutorelease(ABAddressBookCopyPeopleWithName(addressBook_, - (CFStringRef)prefix)); - NSMutableArray *gtmPeople = [NSMutableArray arrayWithCapacity:[people count]]; - id person; - for (person in people) { - GTMABPerson *gtmPerson = [GTMABPerson recordWithRecord:person]; - [gtmPeople addObject:gtmPerson]; - } - return gtmPeople; -#else - // TODO(dmaclach): Change over to recordsMatchingSearchElement as an - // optimization? - // TODO(dmaclach): Make this match the way that the iPhone does it (by - // checking both first and last names) and adding unittests for all this. - NSArray *people = [self people]; - NSMutableArray *foundPeople = [NSMutableArray array]; - GTMABPerson *person; - for (person in people) { - NSString *compositeName = [person compositeName]; - NSRange range = [compositeName rangeOfString:prefix - options:(NSCaseInsensitiveSearch - | NSDiacriticInsensitiveSearch - | NSWidthInsensitiveSearch - | NSAnchoredSearch)]; - if (range.location != NSNotFound) { - [foundPeople addObject:person]; - } - } - return foundPeople; -#endif -} - -// Performs a prefix search on the composite names of groups in an address book -// and returns an array of groups that match the search criteria. -- (NSArray *)groupsWithCompositeNameWithPrefix:(NSString *)prefix { - NSArray *groups = [self groups]; - NSMutableArray *foundGroups = [NSMutableArray array]; - GTMABGroup *group; - for (group in groups) { - NSString *compositeName = [group compositeName]; - NSRange range = [compositeName rangeOfString:prefix - options:(NSCaseInsensitiveSearch - | NSDiacriticInsensitiveSearch - | NSWidthInsensitiveSearch - | NSAnchoredSearch)]; - if (range.location != NSNotFound) { - [foundGroups addObject:group]; - } - } - return foundGroups; -} - -+ (NSString *)localizedLabel:(NSString *)label { -#if GTM_IPHONE_SDK - return GTMCFAutorelease(ABAddressBookCopyLocalizedLabel((CFStringRef)label)); -#else // GTM_IPHONE_SDK - return GTMCFAutorelease(ABCopyLocalizedPropertyOrLabel((CFStringRef)label)); -#endif // GTM_IPHONE_SDK -} - -@end - -@implementation GTMABRecord -+ (id)recordWithRecord:(ABRecordRef)record { - return [[[self alloc] initWithRecord:record] autorelease]; -} - -- (id)initWithRecord:(ABRecordRef)record { - if ((self = [super init])) { - if ([self class] == [GTMABRecord class]) { - [self autorelease]; - [self doesNotRecognizeSelector:_cmd]; - } - if (!record) { - [self release]; - self = nil; - } else { - record_ = (ABRecordRef)CFRetain(record); - } - } - return self; -} - -- (NSUInteger)hash { - // This really isn't completely valid due to - // 6203836 ABRecords hash to their address - // but it's the best we can do without knowing what properties - // are in a record, and we don't have an API for that. - return CFHash(record_); -} - -- (BOOL)isEqual:(id)object { - // This really isn't completely valid due to - // 6203836 ABRecords hash to their address - // but it's the best we can do without knowing what properties - // are in a record, and we don't have an API for that. - return [object respondsToSelector:@selector(recordRef)] - && CFEqual(record_, [object recordRef]); -} - -- (void)dealloc { - if (record_) { - CFRelease(record_); - } - [super dealloc]; -} - -- (ABRecordRef)recordRef { - return record_; -} - -- (GTMABRecordID)recordID { -#if GTM_IPHONE_SDK - return ABRecordGetRecordID(record_); -#else // GTM_IPHONE_SDK - return GTMCFAutorelease(ABRecordCopyUniqueId(record_)); -#endif // GTM_IPHONE_SDK -} - -- (id)valueForProperty:(GTMABPropertyID)property { -#if GTM_IPHONE_SDK - id value = GTMCFAutorelease(ABRecordCopyValue(record_, property)); -#else // GTM_IPHONE_SDK - id value = GTMCFAutorelease(ABRecordCopyValue(record_, (CFStringRef)property)); -#endif // GTM_IPHONE_SDK - if (value) { - if ([[self class] typeOfProperty:property] & kABMultiValueMask) { - value = [[[GTMABMultiValue alloc] - initWithMultiValue:(ABMultiValueRef)value] autorelease]; - } - } - return value; -} - -- (BOOL)setValue:(id)value forProperty:(GTMABPropertyID)property { - if (!value) return NO; - // We check the type here because of - // Radar 6201046 ABRecordSetValue returns true even if you pass in a bad type - // for a value - TypeClassNameMap fullTypeMap[] = { - { kGTMABStringPropertyType, [NSString class] }, - { kGTMABIntegerPropertyType, [NSNumber class] }, - { kGTMABRealPropertyType, [NSNumber class] }, - { kGTMABDateTimePropertyType, [NSDate class] }, - { kGTMABDictionaryPropertyType, [NSDictionary class] }, - { kGTMABMultiStringPropertyType, [GTMABMultiValue class] }, - { kGTMABMultiRealPropertyType, [GTMABMultiValue class] }, - { kGTMABMultiDateTimePropertyType, [GTMABMultiValue class] }, - { kGTMABMultiDictionaryPropertyType, [GTMABMultiValue class] } - }; - GTMABPropertyType type = [[self class] typeOfProperty:property]; - BOOL wasFound = NO; - for (size_t i = 0; i < sizeof(fullTypeMap) / sizeof(TypeClassNameMap); ++i) { - if (fullTypeMap[i].pType == type) { - wasFound = YES; - if (![[value class] isSubclassOfClass:fullTypeMap[i].class]) { - return NO; - } - } - } - if (!wasFound) { - return NO; - } - if (type & kABMultiValueMask) { - value = (id)[value multiValueRef]; - } -#if GTM_IPHONE_SDK - CFErrorRef cfError = nil; - bool wasGood = ABRecordSetValue(record_, property, - (CFTypeRef)value, &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - bool wasGood = ABRecordSetValue(record_, (CFStringRef)property, (CFTypeRef)value); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (BOOL)removeValueForProperty:(GTMABPropertyID)property { -#if GTM_IPHONE_SDK - CFErrorRef cfError = nil; - // We check to see if the value is in the property because of: - // Radar 6201005 ABRecordRemoveValue returns true for value that aren't - // in the record - id value = [self valueForProperty:property]; - bool wasGood = value && ABRecordRemoveValue(record_, property, &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - id value = [self valueForProperty:property]; - bool wasGood = value && ABRecordRemoveValue(record_, (CFStringRef)property); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -// COV_NF_START -// All of these methods are to be overridden by their subclasses - -- (NSString *)compositeName { - [self doesNotRecognizeSelector:_cmd]; - return nil; -} - -+ (GTMABPropertyType)typeOfProperty:(GTMABPropertyID)property { - [self doesNotRecognizeSelector:_cmd]; - return kGTMABInvalidPropertyType; -} - -+ (NSString *)localizedPropertyName:(GTMABPropertyID)property { - [self doesNotRecognizeSelector:_cmd]; - return nil; -} -// COV_NF_END -@end - -@implementation GTMABPerson - -+ (GTMABPerson *)personWithFirstName:(NSString *)first - lastName:(NSString *)last { - GTMABPerson *person = [[[self alloc] init] autorelease]; - if (person) { - BOOL isGood = YES; - if (first) { - isGood = [person setValue:first - forProperty:kGTMABPersonFirstNameProperty]; - } - if (isGood && last) { - isGood = [person setValue:last forProperty:kGTMABPersonLastNameProperty]; - } - if (!isGood) { - // COV_NF_START - // Marked as NF because I don't know how to force an error - person = nil; - // COV_NF_END - } - } - return person; -} - -- (id)init { - ABRecordRef person = ABPersonCreate(); - self = [super initWithRecord:person]; - if (person) { - CFRelease(person); - } - return self; -} - -- (BOOL)setImageData:(NSData *)data { -#if GTM_IPHONE_SDK - CFErrorRef cfError = NULL; - bool wasGood = NO; - if (!data) { - wasGood = ABPersonRemoveImageData([self recordRef], &cfError); - } else { - // We verify that the data is good because of: - // Radar 6202868 ABPersonSetImageData should validate image data - UIImage *image = [UIImage imageWithData:data]; - wasGood = image && ABPersonSetImageData([self recordRef], - (CFDataRef)data, &cfError); - } - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - bool wasGood = YES; - if (data) { - NSImage *image = [[[NSImage alloc] initWithData:data] autorelease]; - wasGood = image != nil; - } - wasGood = wasGood && ABPersonSetImageData([self recordRef], (CFDataRef)data); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (GTMABImage *)image { - NSData *data = [self imageData]; -#if GTM_IPHONE_SDK - return [UIImage imageWithData:data]; -#else // GTM_IPHONE_SDK - return [[[NSImage alloc] initWithData:data] autorelease]; -#endif // GTM_IPHONE_SDK -} - -- (BOOL)setImage:(GTMABImage *)image { -#if GTM_IPHONE_SDK - NSData *data = UIImagePNGRepresentation(image); -#else // GTM_IPHONE_SDK - NSData *data = [image TIFFRepresentation]; -#endif // GTM_IPHONE_SDK - return [self setImageData:data]; -} - -- (NSData *)imageData { - return GTMCFAutorelease(ABPersonCopyImageData([self recordRef])); -} - -- (NSString *)compositeName { -#if GTM_IPHONE_SDK - return GTMCFAutorelease(ABRecordCopyCompositeName([self recordRef])); -#else // GTM_IPHONE_SDK - NSNumber *nsFlags = [self valueForProperty:kABPersonFlags]; - NSInteger flags = [nsFlags longValue]; - NSString *compositeName = nil; - if (flags & kABShowAsCompany) { - compositeName = [self valueForProperty:kABOrganizationProperty]; - } else { - NSString *firstName = [self valueForProperty:kGTMABPersonFirstNameProperty]; - NSString *lastName = [self valueForProperty:kGTMABPersonLastNameProperty]; - - if (firstName && lastName) { - GTMABPersonCompositeNameFormat format; - if (flags & kABFirstNameFirst) { - format = kABPersonCompositeNameFormatFirstNameFirst; - } else if (flags & kABLastNameFirst) { - format = kABPersonCompositeNameFormatLastNameFirst; - } else { - format = [[self class] compositeNameFormat]; - } - if (format == kABPersonCompositeNameFormatLastNameFirst) { - NSString *tempStr = lastName; - lastName = firstName; - firstName = tempStr; - } - compositeName = [NSString stringWithFormat:@"%@ %@", firstName, lastName]; - } else if (firstName) { - compositeName = firstName; - } else if (lastName) { - compositeName = lastName; - } else { - compositeName = @""; - } - } - - return compositeName; -#endif // GTM_IPHONE_SDK -} - -- (NSString *)description { -#if GTM_IPHONE_SDK - return [NSString stringWithFormat:@"%@ %@ %@ %d", - [self class], - [self valueForProperty:kGTMABPersonFirstNameProperty], - [self valueForProperty:kGTMABPersonLastNameProperty], - [self recordID]]; -#else // GTM_IPHONE_SDK - return [NSString stringWithFormat:@"%@ %@ %@ %@", - [self class], - [self valueForProperty:kGTMABPersonFirstNameProperty], - [self valueForProperty:kGTMABPersonLastNameProperty], - [self recordID]]; -#endif // GTM_IPHONE_SDK -} - -+ (NSString *)localizedPropertyName:(GTMABPropertyID)property { -#if GTM_IPHONE_SDK - return GTMCFAutorelease(ABPersonCopyLocalizedPropertyName(property)); -#else // GTM_IPHONE_SDK - return ABLocalizedPropertyOrLabel(property); -#endif // GTM_IPHONE_SDK -} - -+ (GTMABPersonCompositeNameFormat)compositeNameFormat { -#if GTM_IPHONE_SDK - #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 - return ABPersonGetCompositeNameFormat(); - #else - return ABPersonGetCompositeNameFormatForRecord(NULL); - #endif // __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 -#else // GTM_IPHONE_SDK - NSInteger nameOrdering - = [[ABAddressBook sharedAddressBook] defaultNameOrdering]; - return nameOrdering == kABFirstNameFirst ? - kABPersonCompositeNameFormatFirstNameFirst : - kABPersonCompositeNameFormatLastNameFirst; -#endif // GTM_IPHONE_SDK -} - -+ (GTMABPropertyType)typeOfProperty:(GTMABPropertyID)property { -#if GTM_IPHONE_SDK - return ABPersonGetTypeOfProperty(property); -#else // GTM_IPHONE_SDK - return ABTypeOfProperty([[GTMABAddressBook addressBook] addressBookRef], - (CFStringRef)kABPersonRecordType, - (CFStringRef)property); -#endif // GTM_IPHONE_SDK -} -@end - -@implementation GTMABGroup - -+ (GTMABGroup *)groupNamed:(NSString *)name { - GTMABGroup *group = [[[self alloc] init] autorelease]; - if (group) { - if (![group setValue:name forProperty:kABGroupNameProperty]) { - // COV_NF_START - // Can't get setValue to fail for me - group = nil; - // COV_NF_END - } - } - return group; -} - -- (id)init { - ABRecordRef group = ABGroupCreate(); - self = [super initWithRecord:group]; - if (group) { - CFRelease(group); - } - return self; -} - -- (NSArray *)members { - NSArray *people - = GTMCFAutorelease(ABGroupCopyArrayOfAllMembers([self recordRef])); - NSMutableArray *gtmPeople = [NSMutableArray arrayWithCapacity:[people count]]; - id person; - for (person in people) { - [gtmPeople addObject:[GTMABPerson recordWithRecord:(ABRecordRef)person]]; - } - return gtmPeople; -} - -- (BOOL)addMember:(GTMABPerson *)person { -#if GTM_IPHONE_SDK - CFErrorRef cfError = nil; - // We check for person because of - // Radar 6202860 Passing nil person into ABGroupAddMember crashes - bool wasGood = person && ABGroupAddMember([self recordRef], - [person recordRef], &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - bool wasGood = person && ABGroupAddMember([self recordRef], - [person recordRef]); -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (BOOL)removeMember:(GTMABPerson *)person { -#if GTM_IPHONE_SDK - CFErrorRef cfError = nil; - // We check for person because of - // Radar 6202860 Passing nil person into ABGroupAddMember crashes - // (I know this is remove, but it crashes there too) - bool wasGood = person && ABGroupRemoveMember([self recordRef], - [person recordRef], &cfError); - if (cfError) { - // COV_NF_START - _GTMDevLog(@"Error in [%@ %@]: %@", - [self class], NSStringFromSelector(_cmd), cfError); - CFRelease(cfError); - // COV_NF_END - } -#else // GTM_IPHONE_SDK - bool wasGood = person != nil; - if (wasGood) { - NSArray *array = GTMCFAutorelease(ABPersonCopyParentGroups([person recordRef])); - if ([array containsObject:[self recordRef]]) { - wasGood = ABGroupRemoveMember([self recordRef], - [person recordRef]); - } else { - wasGood = NO; - } - } -#endif // GTM_IPHONE_SDK - return wasGood ? YES : NO; -} - -- (NSString *)compositeName { -#if GTM_IPHONE_SDK - return GTMCFAutorelease(ABRecordCopyCompositeName([self recordRef])); -#else // GTM_IPHONE_SDK - return [self valueForProperty:kGTMABGroupNameProperty]; -#endif // GTM_IPHONE_SDK -} - -+ (GTMABPropertyType)typeOfProperty:(GTMABPropertyID)property { - GTMABPropertyType type = kGTMABInvalidPropertyType; - if (property == kABGroupNameProperty) { - type = kGTMABStringPropertyType; - } - return type; -} - -+ (NSString *)localizedPropertyName:(GTMABPropertyID)property { - NSString *name = kGTMABUnknownPropertyName; - if (property == kABGroupNameProperty) { - name = NSLocalizedStringFromTable(@"Name", - @"GTMABAddressBook", - @"name property"); - } - return name; -} - -- (NSString *)description { -#if GTM_IPHONE_SDK - return [NSString stringWithFormat:@"%@ %@ %d", - [self class], - [self valueForProperty:kABGroupNameProperty], - [self recordID]]; -#else // GTM_IPHONE_SDK - return [NSString stringWithFormat:@"%@ %@ %@", - [self class], - [self valueForProperty:kABGroupNameProperty], - [self recordID]]; -#endif // GTM_IPHONE_SDK -} -@end - -@implementation GTMABMultiValue -- (id)init { - // Call super init and release so we don't leak - [[super init] autorelease]; - [self doesNotRecognizeSelector:_cmd]; - return nil; // COV_NF_LINE -} - -- (id)initWithMultiValue:(ABMultiValueRef)multiValue { - if ((self = [super init])) { - if (!multiValue) { - [self release]; - self = nil; - } else { - multiValue_ = CFRetain(multiValue); - } - } - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - return [[GTMABMultiValue alloc] initWithMultiValue:multiValue_]; -} - -- (id)mutableCopyWithZone:(NSZone *)zone { - return [[GTMABMutableMultiValue alloc] initWithMultiValue:multiValue_]; -} - -- (NSUInteger)hash { - // I'm implementing hash instead of using CFHash(multiValue_) because - // 6203854 ABMultiValues hash to their address - NSUInteger count = [self count]; - NSUInteger hash = 0; - for (NSUInteger i = 0; i < count; ++i) { - NSString *label = [self labelAtIndex:i]; - id value = [self valueAtIndex:i]; - hash += [label hash]; - hash += [value hash]; - } - return hash; -} - -- (BOOL)isEqual:(id)object { - // I'm implementing isEqual instea of using CFEquals(multiValue,...) because - // 6203854 ABMultiValues hash to their address - // and it appears CFEquals just calls through to hash to compare them. - BOOL isEqual = NO; - if ([object respondsToSelector:@selector(multiValueRef)]) { - isEqual = multiValue_ == [object multiValueRef]; - if (!isEqual) { - NSUInteger count = [self count]; - NSUInteger objCount = [(GTMABMultiValue *)object count]; - isEqual = count == objCount; - for (NSUInteger i = 0; isEqual && i < count; ++i) { - NSString *label = [self labelAtIndex:i]; - NSString *objLabel = [object labelAtIndex:i]; - isEqual = [label isEqual:objLabel]; - if (isEqual) { - id value = [self valueAtIndex:i]; - GTMABMultiValue *multiValueObject - = GTM_STATIC_CAST(GTMABMultiValue, object); - id objValue = [multiValueObject valueAtIndex:i]; - isEqual = [value isEqual:objValue]; - } - } - } - } - return isEqual; -} - -- (void)dealloc { - if (multiValue_) { - CFRelease(multiValue_); - } - [super dealloc]; -} - -- (ABMultiValueRef)multiValueRef { - return multiValue_; -} - -- (NSUInteger)count { -#if GTM_IPHONE_SDK - return ABMultiValueGetCount(multiValue_); -#else // GTM_IPHONE_SDK - return ABMultiValueCount(multiValue_); -#endif // GTM_IPHONE_SDK -} - -- (id)valueAtIndex:(NSUInteger)idx { - id value = nil; - if (idx < [self count]) { - value = GTMCFAutorelease(ABMultiValueCopyValueAtIndex(multiValue_, idx)); - ABPropertyType type = [self propertyType]; - if (type == kGTMABIntegerPropertyType - || type == kGTMABRealPropertyType - || type == kGTMABDictionaryPropertyType) { - // This is because of - // 6208390 Integer and real values don't work in ABMultiValueRefs - // Apparently they forget to add a ref count on int, real and - // dictionary values in ABMultiValueCopyValueAtIndex, although they do - // remember them for all other types. - // Once they fix this, this will lead to a leak, but I figure the leak - // is better than the crash. Our unittests will test to make sure that - // this is the case, and once we find a system that has this fixed, we - // can conditionalize this code. Look for testRadar6208390 in - // GTMABAddressBookTest.m - // Also, search for 6208390 below and fix the fast enumerator to actually - // be somewhat performant when this is fixed. -#ifndef __clang_analyzer__ - [value retain]; -#endif // __clang_analyzer__ - } - } - return value; -} - -- (NSString *)labelAtIndex:(NSUInteger)idx { - NSString *label = nil; - if (idx < [self count]) { - label = GTMCFAutorelease(ABMultiValueCopyLabelAtIndex(multiValue_, idx)); - } - return label; -} - -- (GTMABMultiValueIdentifier)identifierAtIndex:(NSUInteger)idx { - GTMABMultiValueIdentifier identifier = kGTMABMultiValueInvalidIdentifier; - if (idx < [self count]) { -#if GTM_IPHONE_SDK - identifier = ABMultiValueGetIdentifierAtIndex(multiValue_, idx); -#else // GTM_IPHONE_SDK - identifier = GTMCFAutorelease(ABMultiValueCopyIdentifierAtIndex(multiValue_, - idx)); -#endif // GTM_IPHONE_SDK - } - return identifier; -} - -- (NSUInteger)indexForIdentifier:(GTMABMultiValueIdentifier)identifier { -#if GTM_IPHONE_SDK - NSUInteger idx = ABMultiValueGetIndexForIdentifier(multiValue_, identifier); -#else // GTM_IPHONE_SDK - NSUInteger idx = ABMultiValueIndexForIdentifier(multiValue_, - (CFStringRef)identifier); -#endif // GTM_IPHONE_SDK - return idx == (NSUInteger)kCFNotFound ? (NSUInteger)NSNotFound : idx; -} - -- (GTMABPropertyType)propertyType { -#if GTM_IPHONE_SDK - return ABMultiValueGetPropertyType(multiValue_); -#else // GTM_IPHONE_SDK - return ABMultiValuePropertyType(multiValue_); -#endif // GTM_IPHONE_SDK -} - -- (id)valueForIdentifier:(GTMABMultiValueIdentifier)identifier { - return [self valueAtIndex:[self indexForIdentifier:identifier]]; -} - -- (NSString *)labelForIdentifier:(GTMABMultiValueIdentifier)identifier { - return [self labelAtIndex:[self indexForIdentifier:identifier]]; -} - -- (unsigned long*)mutations { - // We just need some constant non-zero value here so fast enumeration works. - // Dereferencing self should give us the isa which will stay constant - // over the enumeration. - return (unsigned long*)self; -} - -- (NSEnumerator *)valueEnumerator { - return [GTMABMultiValueEnumerator valueEnumeratorFor:self]; -} - -- (NSEnumerator *)labelEnumerator { - return [GTMABMultiValueEnumerator labelEnumeratorFor:self]; -} - -@end - -@implementation GTMABMutableMultiValue -+ (id)valueWithPropertyType:(GTMABPropertyType)type { - return [[[self alloc] initWithPropertyType:type] autorelease]; -} - -- (id)initWithPropertyType:(GTMABPropertyType)type { - ABMutableMultiValueRef ref = nil; - if (type != kGTMABInvalidPropertyType) { -#if GTM_IPHONE_SDK - ref = ABMultiValueCreateMutable(type); -#else // GTM_IPHONE_SDK - ref = ABMultiValueCreateMutable(); -#endif // GTM_IPHONE_SDK - } - self = [super initWithMultiValue:ref]; - if (ref) { - CFRelease(ref); - } - return self; -} - -- (id)initWithMultiValue:(ABMultiValueRef)multiValue { - ABMutableMultiValueRef ref = nil; - if (multiValue) { - ref = ABMultiValueCreateMutableCopy(multiValue); - } - self = [super initWithMultiValue:ref]; - if (ref) { - CFRelease(ref); - } - return self; -} - -- (id)initWithMutableMultiValue:(ABMutableMultiValueRef)multiValue { - return [super initWithMultiValue:multiValue]; -} - -- (BOOL)checkValueType:(id)value { - BOOL isGood = NO; - if (value) { - TypeClassNameMap singleValueTypeMap[] = { - { kGTMABStringPropertyType, [NSString class] }, - { kGTMABIntegerPropertyType, [NSNumber class] }, - { kGTMABRealPropertyType, [NSNumber class] }, - { kGTMABDateTimePropertyType, [NSDate class] }, - { kGTMABDictionaryPropertyType, [NSDictionary class] }, - }; - GTMABPropertyType type = [self propertyType] & ~kABMultiValueMask; -#if GTM_MACOS_SDK - // Since on the desktop mutables don't have a type UNTIL they have - // something in them, return YES if it's empty. - if ((type == 0) && ([self count] == 0)) return YES; -#endif // GTM_MACOS_SDK - for (size_t i = 0; - i < sizeof(singleValueTypeMap) / sizeof(TypeClassNameMap); ++i) { - if (singleValueTypeMap[i].pType == type) { - if ([[value class] isSubclassOfClass:singleValueTypeMap[i].class]) { - isGood = YES; - break; - } - } - } - } - return isGood; -} - -- (GTMABMultiValueIdentifier)addValue:(id)value withLabel:(CFStringRef)label { - GTMABMultiValueIdentifier identifier = kGTMABMultiValueInvalidIdentifier; - // We check label and value here because of - // radar 6202827 Passing nil info ABMultiValueAddValueAndLabel causes crash - bool wasGood = label && [self checkValueType:value]; - if (wasGood) { -#if GTM_IPHONE_SDK - wasGood = ABMultiValueAddValueAndLabel(multiValue_, - value, - label, - &identifier); -#else // GTM_IPHONE_SDK - wasGood = ABMultiValueAdd((ABMutableMultiValueRef)multiValue_, - value, - label, - (CFStringRef *)&identifier); -#endif // GTM_IPHONE_SDK - } - if (!wasGood) { - identifier = kGTMABMultiValueInvalidIdentifier; - } else { - mutations_++; - } - return identifier; -} - -- (GTMABMultiValueIdentifier)insertValue:(id)value - withLabel:(CFStringRef)label - atIndex:(NSUInteger)idx { - GTMABMultiValueIdentifier identifier = kGTMABMultiValueInvalidIdentifier; - // We perform a check here to ensure that we don't get bitten by - // Radar 6202807 ABMultiValueInsertValueAndLabelAtIndex allows you to insert - // values past end - NSUInteger count = [self count]; - // We check label and value here because of - // radar 6202827 Passing nil info ABMultiValueAddValueAndLabel causes crash - bool wasGood = idx <= count && label && [self checkValueType:value]; - if (wasGood) { -#if GTM_IPHONE_SDK - wasGood = ABMultiValueInsertValueAndLabelAtIndex(multiValue_, - value, - label, - idx, - &identifier); -#else // GTM_IPHONE_SDK - wasGood = ABMultiValueInsert((ABMutableMultiValueRef)multiValue_, - value, - label, - idx, - (CFStringRef *)&identifier); -#endif // GTM_IPHONE_SDK - } - if (!wasGood) { - identifier = kGTMABMultiValueInvalidIdentifier; - } else { - mutations_++; - } - return identifier; -} - -- (BOOL)removeValueAndLabelAtIndex:(NSUInteger)idx { - BOOL isGood = NO; - NSUInteger count = [self count]; - if (idx < count) { -#if GTM_IPHONE_SDK - bool wasGood = ABMultiValueRemoveValueAndLabelAtIndex(multiValue_, - idx); -#else // GTM_IPHONE_SDK - bool wasGood = ABMultiValueRemove((ABMutableMultiValueRef)multiValue_, - idx); -#endif // GTM_IPHONE_SDK - if (wasGood) { - mutations_++; - isGood = YES; - } - } - return isGood; -} - -- (BOOL)replaceValueAtIndex:(NSUInteger)idx withValue:(id)value { - BOOL isGood = NO; - NSUInteger count = [self count]; - if (idx < count && [self checkValueType:value]) { -#if GTM_IPHONE_SDK - bool goodReplace = ABMultiValueReplaceValueAtIndex(multiValue_, - value, idx); -#else // GTM_IPHONE_SDK - bool goodReplace - = ABMultiValueReplaceValue((ABMutableMultiValueRef)multiValue_, - (CFTypeRef)value, idx); -#endif // GTM_IPHONE_SDK - if (goodReplace) { - mutations_++; - isGood = YES; - } - } - return isGood; -} - -- (BOOL)replaceLabelAtIndex:(NSUInteger)idx withLabel:(CFStringRef)label { - BOOL isGood = NO; - NSUInteger count = [self count]; - if (idx < count) { -#if GTM_IPHONE_SDK - bool goodReplace = ABMultiValueReplaceLabelAtIndex(multiValue_, - label, idx); -#else // GTM_IPHONE_SDK - bool goodReplace - = ABMultiValueReplaceLabel((ABMutableMultiValueRef)multiValue_, - (CFTypeRef)label, idx); -#endif // GTM_IPHONE_SDK - if (goodReplace) { - mutations_++; - isGood = YES; - } - } - return isGood; -} - -- (unsigned long*)mutations { - return &mutations_; -} -@end - - -@implementation GTMABMultiValueEnumerator - -+ (id)valueEnumeratorFor:(GTMABMultiValue*)enumeree { - return [[[self alloc] initWithEnumeree:enumeree useLabels:NO] autorelease]; -} - -+ (id)labelEnumeratorFor:(GTMABMultiValue*)enumeree { - return [[[self alloc] initWithEnumeree:enumeree useLabels:YES] autorelease]; -} - -- (id)initWithEnumeree:(GTMABMultiValue*)enumeree useLabels:(BOOL)useLabels { - if ((self = [super init])) { - if (enumeree) { - enumeree_ = [enumeree retain]; - useLabels_ = useLabels; - } else { - // COV_NF_START - // Since this is a private class where the enumeree creates us - // there is no way we should ever get here. - [self release]; - self = nil; - // COV_NF_END - } - } - return self; -} - -- (void)dealloc { - [enumeree_ release]; - [super dealloc]; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - objects:(id *)stackbuf - count:(NSUInteger)len { - NSUInteger i; - if (!ref_) { - count_ = [enumeree_ count]; - ref_ = [enumeree_ multiValueRef]; - } - - for (i = 0; state->state < count_ && i < len; ++i, ++state->state) { - if (useLabels_) { - stackbuf[i] = GTMCFAutorelease(ABMultiValueCopyLabelAtIndex(ref_, - state->state)); - } else { - // TODO(dmaclach) Check this on Mac Desktop and use fast path if we can - // Yes this is slow, but necessary in light of radar 6208390 - // Once this is fixed we can go to something similar to the label - // case which should speed stuff up again. Hopefully anybody who wants - // real performance is willing to move down to the C API anyways. - stackbuf[i] = [enumeree_ valueAtIndex:state->state]; - } - } - - state->itemsPtr = stackbuf; - state->mutationsPtr = [enumeree_ mutations]; - return i; -} - -- (id)nextObject { - id value = nil; - if (!ref_) { - count_ = [enumeree_ count]; - mutations_ = *[enumeree_ mutations]; - ref_ = [enumeree_ multiValueRef]; - - } - if (mutations_ != *[enumeree_ mutations]) { - NSString *reason = [NSString stringWithFormat:@"*** Collection <%@> was " - "mutated while being enumerated", enumeree_]; - [[NSException exceptionWithName:NSGenericException - reason:reason - userInfo:nil] raise]; - } - if (index_ < count_) { - if (useLabels_) { - value = GTMCFAutorelease(ABMultiValueCopyLabelAtIndex(ref_, - index_)); - } else { - // TODO(dmaclach) Check this on Mac Desktop and use fast path if we can - // Yes this is slow, but necessary in light of radar 6208390 - // Once this is fixed we can go to something similar to the label - // case which should speed stuff up again. Hopefully anybody who wants - // real performance is willing to move down to the C API anyways. - value = [enumeree_ valueAtIndex:index_]; - } - index_ += 1; - } - return value; -} -@end - diff --git a/AddressBook/GTMABAddressBook.strings b/AddressBook/GTMABAddressBook.strings deleted file mode 100644 index 370f566..0000000 --- a/AddressBook/GTMABAddressBook.strings +++ /dev/null @@ -1,22 +0,0 @@ -// -// GTMABAddressBook.strings -// -// Copyright 2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// enUS strings for GTMABAddressBook - -// Group name label -"Name" = "Name"; diff --git a/AddressBook/GTMABAddressBookTest.m b/AddressBook/GTMABAddressBookTest.m deleted file mode 100644 index 9037369..0000000 --- a/AddressBook/GTMABAddressBookTest.m +++ /dev/null @@ -1,713 +0,0 @@ -// -// GTMABAddressBookTest.m -// -// Copyright 2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -#import "GTMSenTestCase.h" -#import "GTMABAddressBook.h" - -#if GTM_IPHONE_SDK -#import "UIKit/UIKit.h" -#else -#import -#endif // GTM_IPHONE_SDK - -static NSString *const kGTMABTestFirstName = @"GTMABAddressBookTestFirstName"; -static NSString *const kGTMABTestLastName = @"GTMABAddressBookTestLastName"; -static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName"; - -@interface GTMABAddressBookTest : GTMTestCase { - @private - GTMABAddressBook *book_; -} -@end - - -@implementation GTMABAddressBookTest - -#if GTM_IPHONE_SDK - -// On iOS we need to check if we have access to the Address Book before running any tests. -// See -// third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMIPhoneUnitTestMain.m -// for a way this can be provided via entitlements. - -+ (void)setUp { - [super setUp]; - ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus(); - if(status != kABAuthorizationStatusAuthorized) { - [NSException raise:NSInternalInconsistencyException format:@"Don't have Address Book Access"]; - } -} - -#endif // GTM_IPHONE_SDK - -- (void)setUp { - // Create a book forcing it out of it's autorelease pool. - // I force it out of the release pool, so that we will see any errors - // for it immediately at teardown, and it will be clear which release - // caused us problems. - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - book_ = [[GTMABAddressBook addressBook] retain]; - [pool release]; - XCTAssertNotNil(book_); - NSArray *people - = [book_ peopleWithCompositeNameWithPrefix:kGTMABTestFirstName]; - GTMABPerson *person; - for (person in people) { - [book_ removeRecord:person]; - } - NSArray *groups - = [book_ groupsWithCompositeNameWithPrefix:kGTMABTestGroupName]; - GTMABGroup *group; - for (group in groups) { - [book_ removeRecord:group]; - } - [book_ save]; -} - -- (void)tearDown { - [book_ release]; -} - -- (void)testGenericAddressBook { - XCTAssertEqualObjects([GTMABAddressBook localizedLabel:(NSString *)kABHomeLabel], - @"home"); - XCTAssertThrows([GTMABRecord recordWithRecord:nil]); -} - -- (void)testAddingAndRemovingPerson { - // Create a person - GTMABPerson *person = [GTMABPerson personWithFirstName:kGTMABTestFirstName - lastName:kGTMABTestLastName]; - XCTAssertNotNil(person); - - // Add person - NSArray *people = [book_ people]; - XCTAssertFalse([people containsObject:person]); - XCTAssertTrue([book_ addRecord:person]); -#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2) - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work - // We will check to make sure it stays broken ;-) - XCTAssertFalse([book_ hasUnsavedChanges]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([book_ hasUnsavedChanges]); -#endif // GTM_IPHONE_SDK - - people = [book_ people]; - XCTAssertNotNil(people); -#if GTM_IPHONE_SDK - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the people - // array until it's saved - // We will check to make sure it stays broken ;-) - XCTAssertFalse([people containsObject:person]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([people containsObject:person]); -#endif // GTM_IPHONE_SDK - - // Save book_ - XCTAssertTrue([book_ save]); - people = [book_ people]; - XCTAssertNotNil(people); - XCTAssertTrue([people containsObject:person]); - people = [book_ peopleWithCompositeNameWithPrefix:kGTMABTestFirstName]; - XCTAssertEqualObjects([people objectAtIndex:0], person); - - GTMABRecordID recordID = [person recordID]; - XCTAssertNotEqual(recordID, kGTMABRecordInvalidID); - - GTMABRecord *record = [book_ personForId:recordID]; - XCTAssertEqualObjects(record, person); - - // Remove person - XCTAssertTrue([book_ removeRecord:person]); - people = [book_ peopleWithCompositeNameWithPrefix:kGTMABTestFirstName]; - XCTAssertEqual([people count], (NSUInteger)0); - -#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2) - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work - // We will check to make sure it stays broken ;-) - XCTAssertFalse([book_ hasUnsavedChanges]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([book_ hasUnsavedChanges]); -#endif // GTM_IPHONE_SDK - people = [book_ people]; - XCTAssertFalse([people containsObject:person]); - - // Save Book - XCTAssertTrue([book_ save]); - people = [book_ people]; - XCTAssertFalse([book_ hasUnsavedChanges]); - XCTAssertFalse([people containsObject:person]); - record = [book_ personForId:recordID]; - XCTAssertNil(record); - - // Bogus data - XCTAssertFalse([book_ addRecord:nil]); - XCTAssertFalse([book_ removeRecord:nil]); - - XCTAssertNotNULL([book_ addressBookRef]); - -} - -- (void)testAddingAndRemovingGroup { - // Create a group - GTMABGroup *group = [GTMABGroup groupNamed:kGTMABTestGroupName]; - XCTAssertNotNil(group); - - // Add group - NSArray *groups = [book_ groups]; - XCTAssertFalse([groups containsObject:group]); - XCTAssertTrue([book_ addRecord:group]); -#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2) - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work - // We will check to make sure it stays broken ;-) - XCTAssertFalse([book_ hasUnsavedChanges]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([book_ hasUnsavedChanges]); -#endif // GTM_IPHONE_SDK - - groups = [book_ groups]; - XCTAssertNotNil(groups); -#if GTM_IPHONE_SDK - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the groups - // array until it's saved - // We will check to make sure it stays broken ;-) - XCTAssertFalse([groups containsObject:group]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([groups containsObject:group]); -#endif // GTM_IPHONE_SDK - - // Save book_ - XCTAssertTrue([book_ save]); - groups = [book_ groups]; - XCTAssertNotNil(groups); - XCTAssertTrue([groups containsObject:group]); - groups = [book_ groupsWithCompositeNameWithPrefix:kGTMABTestGroupName]; - XCTAssertEqualObjects([groups objectAtIndex:0], group); - - GTMABRecordID recordID = [group recordID]; - XCTAssertNotEqual(recordID, kGTMABRecordInvalidID); - - GTMABRecord *record = [book_ groupForId:recordID]; - XCTAssertEqualObjects(record, group); - - // Remove group - XCTAssertTrue([book_ removeRecord:group]); - -#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2) - // Normally this next line would be XCTAssertTrue, however due to - // Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work - // We will check to make sure it stays broken ;-) - XCTAssertFalse([book_ hasUnsavedChanges]); -#else // GTM_IPHONE_SDK - XCTAssertTrue([book_ hasUnsavedChanges]); -#endif // GTM_IPHONE_SDK - groups = [book_ groups]; - XCTAssertFalse([groups containsObject:group]); - - // Save Book - XCTAssertTrue([book_ save]); - groups = [book_ groups]; - XCTAssertFalse([book_ hasUnsavedChanges]); - XCTAssertFalse([groups containsObject:group]); - groups = [book_ groupsWithCompositeNameWithPrefix:kGTMABTestGroupName]; - XCTAssertEqual([groups count], (NSUInteger)0); - record = [book_ groupForId:recordID]; - XCTAssertNil(record); -} - -- (void)testPerson { - GTMABPerson *person = [[[GTMABPerson alloc] initWithRecord:nil] autorelease]; - XCTAssertNil(person); - person = [GTMABPerson personWithFirstName:kGTMABTestFirstName - lastName:nil]; - XCTAssertNotNil(person); - XCTAssertEqualObjects([person compositeName], kGTMABTestFirstName); - NSString *firstName = [person valueForProperty:kGTMABPersonFirstNameProperty]; - XCTAssertEqualObjects(firstName, kGTMABTestFirstName); - NSString *lastName = [person valueForProperty:kGTMABPersonLastNameProperty]; - XCTAssertNil(lastName); - XCTAssertTrue([person removeValueForProperty:kGTMABPersonFirstNameProperty]); - XCTAssertFalse([person removeValueForProperty:kGTMABPersonFirstNameProperty]); - XCTAssertFalse([person removeValueForProperty:kGTMABPersonLastNameProperty]); - XCTAssertFalse([person setValue:nil forProperty:kGTMABPersonFirstNameProperty]); - XCTAssertFalse([person setValue:[NSNumber numberWithInt:1] - forProperty:kGTMABPersonFirstNameProperty]); - XCTAssertFalse([person setValue:@"Bart" - forProperty:kGTMABPersonBirthdayProperty]); - - GTMABPropertyType property - = [GTMABPerson typeOfProperty:kGTMABPersonLastNameProperty]; - XCTAssertEqual(property, (GTMABPropertyType)kGTMABStringPropertyType); - - NSString *string - = [GTMABPerson localizedPropertyName:kGTMABPersonLastNameProperty]; - XCTAssertEqualObjects(string, @"Last"); - - string = [GTMABPerson localizedPropertyName:kGTMABRecordInvalidID]; -#if GTM_IPHONE_SDK - XCTAssertEqualObjects(string, kGTMABUnknownPropertyName); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(string, kGTMABRecordInvalidID); -#endif // GTM_IPHONE_SDK - string = [person description]; - XCTAssertNotNil(string); - - GTMABPersonCompositeNameFormat format = [GTMABPerson compositeNameFormat]; - XCTAssertTrue(format == kABPersonCompositeNameFormatFirstNameFirst || - format == kABPersonCompositeNameFormatLastNameFirst); - - NSData *data = [person imageData]; - XCTAssertNil(data); - XCTAssertTrue([person setImageData:nil]); - data = [person imageData]; - XCTAssertNil(data); - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *phonePath = [bundle pathForResource:@"phone" ofType:@"png"]; - XCTAssertNotNil(phonePath); - GTMABImage *image - = [[[GTMABImage alloc] initWithContentsOfFile:phonePath] autorelease]; - XCTAssertNotNil(image); -#if GTM_IPHONE_SDK - data = UIImagePNGRepresentation(image); -#else // GTM_IPHONE_SDK - data = [image TIFFRepresentation]; -#endif // GTM_IPHONE_SDK - XCTAssertTrue([person setImageData:data]); - NSData *data2 = [person imageData]; - XCTAssertEqualObjects(data, data2); - XCTAssertTrue([person setImageData:nil]); - data = [person imageData]; - XCTAssertNil(data); - - XCTAssertTrue([person setImage:image]); - GTMABImage *image2 = [person image]; - XCTAssertNotNil(image2); -#if GTM_IPHONE_SDK - XCTAssertEqualObjects(UIImagePNGRepresentation(image), - UIImagePNGRepresentation(image2)); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects([image TIFFRepresentation], - [image2 TIFFRepresentation]); -#endif // GTM_IPHONE_SDK - - person = [GTMABPerson personWithFirstName:kGTMABTestFirstName - lastName:kGTMABTestLastName]; - - data = [NSData dataWithBytes:"a" length:1]; - XCTAssertFalse([person setImageData:data]); - - GTMABMutableMultiValue *value - = [GTMABMutableMultiValue valueWithPropertyType:kGTMABStringPropertyType]; - XCTAssertNotNil(value); - XCTAssertNotEqual([value addValue:@"222-222-2222" - withLabel:(CFStringRef)kABHomeLabel], - kGTMABMultiValueInvalidIdentifier); - XCTAssertNotEqual([value addValue:@"333-333-3333" - withLabel:(CFStringRef)kABWorkLabel], - kGTMABMultiValueInvalidIdentifier); - XCTAssertTrue([person setValue:value - forProperty:kGTMABPersonPhoneProperty]); - id value2 = [person valueForProperty:kGTMABPersonPhoneProperty]; - XCTAssertNotNil(value2); - XCTAssertEqualObjects(value, value2); - XCTAssertEqual([value hash], [value2 hash]); - XCTAssertNotEqual([person hash], (NSUInteger)0); -} - -- (void)testGroup { - GTMABGroup *group = [[[GTMABGroup alloc] initWithRecord:nil] autorelease]; - XCTAssertNil(group); - group = [GTMABGroup groupNamed:kGTMABTestGroupName]; - XCTAssertNotNil(group); - XCTAssertEqualObjects([group compositeName], kGTMABTestGroupName); - NSString *name = [group valueForProperty:kABGroupNameProperty]; - XCTAssertEqualObjects(name, kGTMABTestGroupName); - NSString *lastName = [group valueForProperty:kGTMABPersonLastNameProperty]; - XCTAssertNil(lastName); - XCTAssertTrue([group removeValueForProperty:kABGroupNameProperty]); - XCTAssertFalse([group removeValueForProperty:kABGroupNameProperty]); - XCTAssertFalse([group removeValueForProperty:kGTMABPersonLastNameProperty]); - XCTAssertFalse([group setValue:nil forProperty:kABGroupNameProperty]); - XCTAssertFalse([group setValue:[NSNumber numberWithInt:1] - forProperty:kABGroupNameProperty]); - XCTAssertFalse([group setValue:@"Bart" - forProperty:kGTMABPersonBirthdayProperty]); - - ABPropertyType property = [GTMABGroup typeOfProperty:kABGroupNameProperty]; - XCTAssertEqual(property, (ABPropertyType)kGTMABStringPropertyType); - - property = [GTMABGroup typeOfProperty:kGTMABPersonLastNameProperty]; - XCTAssertEqual(property, (ABPropertyType)kGTMABInvalidPropertyType); - - NSString *string = [GTMABGroup localizedPropertyName:kABGroupNameProperty]; - XCTAssertEqualObjects(string, @"Name"); - - string = [GTMABGroup localizedPropertyName:kGTMABPersonLastNameProperty]; - XCTAssertEqualObjects(string, kGTMABUnknownPropertyName); - - string = [GTMABGroup localizedPropertyName:kGTMABRecordInvalidID]; - XCTAssertEqualObjects(string, kGTMABUnknownPropertyName); - - string = [group description]; - XCTAssertNotNil(string); - - // Adding and removing members - group = [GTMABGroup groupNamed:kGTMABTestGroupName]; - NSArray *members = [group members]; - XCTAssertEqual([members count], (NSUInteger)0, @"Members: %@", members); - - XCTAssertFalse([group addMember:nil]); - - members = [group members]; - XCTAssertEqual([members count], (NSUInteger)0, @"Members: %@", members); - - GTMABPerson *person = [GTMABPerson personWithFirstName:kGTMABTestFirstName - lastName:kGTMABTestLastName]; - XCTAssertNotNil(person); - XCTAssertTrue([book_ addRecord:person]); - XCTAssertTrue([book_ save]); - XCTAssertTrue([book_ addRecord:group]); - XCTAssertTrue([book_ save]); - XCTAssertTrue([group addMember:person]); - XCTAssertTrue([book_ save]); - members = [group members]; - XCTAssertEqual([members count], (NSUInteger)1, @"Members: %@", members); - XCTAssertTrue([group removeMember:person]); - XCTAssertFalse([group removeMember:person]); - XCTAssertFalse([group removeMember:nil]); - XCTAssertTrue([book_ removeRecord:group]); - XCTAssertTrue([book_ removeRecord:person]); - XCTAssertTrue([book_ save]); -} - - -- (void)testMultiValues { - XCTAssertThrows([[GTMABMultiValue alloc] init]); - XCTAssertThrows([[GTMABMutableMultiValue alloc] init]); - GTMABMultiValue *value = [[GTMABMultiValue alloc] initWithMultiValue:nil]; - XCTAssertNil(value); - GTMABMutableMultiValue *mutValue - = [GTMABMutableMultiValue valueWithPropertyType:kGTMABInvalidPropertyType]; - XCTAssertNil(mutValue); - mutValue - = [[[GTMABMutableMultiValue alloc] - initWithMutableMultiValue:nil] autorelease]; - XCTAssertNil(mutValue); - mutValue - = [[[GTMABMutableMultiValue alloc] - initWithMultiValue:nil] autorelease]; - XCTAssertNil(mutValue); -#if GTM_IPHONE_SDK - // Only the IPhone version actually allows you to check types of a multivalue - // before you stick anything in it - const GTMABPropertyType types[] = { - kGTMABStringPropertyType, - kGTMABIntegerPropertyType, - kGTMABRealPropertyType, - kGTMABDateTimePropertyType, - kGTMABDictionaryPropertyType, - kGTMABMultiStringPropertyType, - kGTMABMultiIntegerPropertyType, - kGTMABMultiRealPropertyType, - kGTMABMultiDateTimePropertyType, - kGTMABMultiDictionaryPropertyType - }; - for (size_t i = 0; i < sizeof(types) / sizeof(GTMABPropertyType); ++i) { - mutValue = [GTMABMutableMultiValue valueWithPropertyType:types[i]]; - XCTAssertNotNil(mutValue); - // 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. - XCTAssertEqual([mutValue propertyType], - (GTMABPropertyType)(types[i] & ~kABMultiValueMask)); - } -#endif // GTM_IPHONE_SDK - mutValue - = [GTMABMutableMultiValue valueWithPropertyType:kGTMABStringPropertyType]; - XCTAssertNotNil(mutValue); - value = [[mutValue copy] autorelease]; - XCTAssertEqualObjects([value class], [GTMABMultiValue class]); - mutValue = [[value mutableCopy] autorelease]; - XCTAssertEqualObjects([mutValue class], [GTMABMutableMultiValue class]); - XCTAssertEqual([mutValue count], (NSUInteger)0); - XCTAssertNil([mutValue valueAtIndex:0]); - XCTAssertNil([mutValue labelAtIndex:0]); -#if GTM_IPHONE_SDK - XCTAssertEqual([mutValue identifierAtIndex:0], - kGTMABMultiValueInvalidIdentifier); - XCTAssertEqual([mutValue propertyType], - (GTMABPropertyType)kGTMABStringPropertyType); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects([mutValue identifierAtIndex:0], - kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - GTMABMultiValueIdentifier ident - = [mutValue addValue:nil withLabel:(CFStringRef)kABHomeLabel]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - - ident = [mutValue addValue:@"val1" - withLabel:nil]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - ident = [mutValue insertValue:@"val1" - withLabel:nil - atIndex:0]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - ident = [mutValue insertValue:nil - withLabel:(CFStringRef)kABHomeLabel - atIndex:0]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - ident = [mutValue addValue:@"val1" - withLabel:(CFStringRef)kABHomeLabel]; -#if GTM_IPHONE_SDK - XCTAssertNotEqual(ident, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertNotEqualObjects(ident, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - GTMABMultiValueIdentifier identCheck = [mutValue identifierAtIndex:0]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident, identCheck); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident, identCheck); -#endif // GTM_IPHONE_SDK - NSUInteger idx = [mutValue indexForIdentifier:ident]; - XCTAssertEqual(idx, (NSUInteger)0); - XCTAssertTrue([mutValue replaceLabelAtIndex:0 - withLabel:(CFStringRef)kABWorkLabel]); - XCTAssertFalse([mutValue replaceLabelAtIndex:10 - withLabel:(CFStringRef)kABWorkLabel]); - XCTAssertTrue([mutValue replaceValueAtIndex:0 - withValue:@"newVal1"]); - XCTAssertFalse([mutValue replaceValueAtIndex:10 - withValue:@"newVal1"]); - - XCTAssertEqualObjects([mutValue valueForIdentifier:ident], @"newVal1"); - XCTAssertEqualObjects([mutValue labelForIdentifier:ident], - (NSString *)kABWorkLabel); - - GTMABMultiValueIdentifier ident2 - = [mutValue insertValue:@"val2" - withLabel:(CFStringRef)kABOtherLabel - atIndex:0]; - XCTAssertNotEqual(ident2, kGTMABMultiValueInvalidIdentifier); - XCTAssertNotEqual(ident2, ident); - GTMABMultiValueIdentifier ident3 - = [mutValue insertValue:@"val3" - withLabel:(CFStringRef)kGTMABPersonPhoneMainLabel - atIndex:10]; -#if GTM_IPHONE_SDK - XCTAssertEqual(ident3, kGTMABMultiValueInvalidIdentifier); -#else // GTM_IPHONE_SDK - XCTAssertEqualObjects(ident3, kGTMABMultiValueInvalidIdentifier); -#endif // GTM_IPHONE_SDK - NSUInteger idx3 = [mutValue indexForIdentifier:ident3]; - XCTAssertEqual(idx3, (NSUInteger)NSNotFound); - XCTAssertTrue([mutValue removeValueAndLabelAtIndex:1]); - XCTAssertFalse([mutValue removeValueAndLabelAtIndex:1]); - - NSUInteger idx4 - = [mutValue indexForIdentifier:kGTMABMultiValueInvalidIdentifier]; - XCTAssertEqual(idx4, (NSUInteger)NSNotFound); - - XCTAssertNotNULL([mutValue multiValueRef]); - - // Enumerator test - mutValue - = [GTMABMutableMultiValue valueWithPropertyType:kGTMABIntegerPropertyType]; - XCTAssertNotNil(mutValue); - for (int i = 0; i < 100; i++) { - NSString *label = [NSString stringWithFormat:@"label %d", i]; - NSNumber *val = [NSNumber numberWithInt:i]; - XCTAssertNotEqual([mutValue addValue:val - withLabel:(CFStringRef)label], - kGTMABMultiValueInvalidIdentifier); - } - int count = 0; - NSString *label; - for (label in [mutValue labelEnumerator]) { - NSString *testLabel = [NSString stringWithFormat:@"label %d", count++]; - XCTAssertEqualObjects(label, testLabel); - } - count = 0; - value = [[mutValue copy] autorelease]; - NSNumber *val; - for (val in [value valueEnumerator]) { - XCTAssertEqualObjects(val, [NSNumber numberWithInt:count++]); - } - - // Test messing with the values while we're enumerating them - NSEnumerator *labelEnum = [mutValue labelEnumerator]; - NSEnumerator *valueEnum = [mutValue valueEnumerator]; - XCTAssertNotNil(labelEnum); - XCTAssertNotNil(valueEnum); - XCTAssertNotNil([labelEnum nextObject]); - XCTAssertNotNil([valueEnum nextObject]); - XCTAssertTrue([mutValue removeValueAndLabelAtIndex:0]); - XCTAssertThrows([labelEnum nextObject]); - XCTAssertThrows([valueEnum nextObject]); - - // Test messing with the values while we're fast enumerating them - // Should throw an exception on the second access. - BOOL exceptionThrown = NO; - // Start at one because we removed index 0 above. - count = 1; - @try { - for (label in [mutValue labelEnumerator]) { - NSString *testLabel = [NSString stringWithFormat:@"label %d", count++]; - XCTAssertEqualObjects(label, testLabel); - XCTAssertTrue([mutValue removeValueAndLabelAtIndex:50]); - } - } @catch(NSException *e) { - XCTAssertEqualObjects([e name], NSGenericException, @"Got %@ instead", e); - XCTAssertEqual(count, 2, - @"Should have caught it on the second access"); - exceptionThrown = YES; - } // COV_NF_LINE - because we always catch, this brace doesn't get exec'd - XCTAssertTrue(exceptionThrown, @"We should have thrown an exception" - @" because the values under the enumerator were modified"); - -} - -#if GTM_IPHONE_SDK - -#if (!defined(__LP64__) || !__LP64__) -// This test does not work on LP64 because refcounts are magic and don't work the -// same as on i386. -- (void)testRadar6208390 { - GTMABPropertyType types[] = { - kGTMABStringPropertyType, - kGTMABIntegerPropertyType, - kGTMABRealPropertyType, - kGTMABDateTimePropertyType, - kGTMABDictionaryPropertyType - }; - for (size_t j = 0; j < sizeof(types) / sizeof(ABPropertyType); ++j) { - ABPropertyType type = types[j]; - ABMultiValueRef ref = ABMultiValueCreateMutable(type); - XCTAssertNotNULL(ref); - NSString *label = [[NSString alloc] initWithString:@"label"]; - XCTAssertNotNil(label); - id val = nil; - if (type == kGTMABDictionaryPropertyType) { - val = [[NSDictionary alloc] initWithObjectsAndKeys:@"1", @"1", nil]; - } else if (type == kGTMABStringPropertyType) { - val = [[NSString alloc] initWithFormat:@"value %zu", j]; - } else if (type == kGTMABIntegerPropertyType - || type == kGTMABRealPropertyType ) { - val = [[NSNumber alloc] initWithInt:143]; - } else if (type == kGTMABDateTimePropertyType) { - val = [[NSDate alloc] init]; - } - XCTAssertNotNil(val, @"Testing type %d, %@", type, val); - NSUInteger firstRetainCount = [val retainCount]; - XCTAssertNotEqual(firstRetainCount, - (NSUInteger)0, - @"Testing type %d, %@", type, val); - - GTMABMultiValueIdentifier identifier; - XCTAssertTrue(ABMultiValueAddValueAndLabel(ref, - val, - (CFStringRef)label, - &identifier), - @"Testing type %d, %@", type, val); - NSUInteger secondRetainCount = [val retainCount]; - XCTAssertEqual(firstRetainCount + 1, - secondRetainCount, - @"Testing type %d, %@", type, val); - [label release]; - [val release]; - NSUInteger thirdRetainCount = [val retainCount]; - XCTAssertEqual(firstRetainCount, - thirdRetainCount, - @"Testing type %d, %@", type, val); - - id oldVal = val; - val = (id)ABMultiValueCopyValueAtIndex(ref, 0); - NSUInteger fourthRetainCount = [val retainCount]; - - // kABDictionaryPropertyTypes appear to do an actual copy, so the retain - // count checking trick won't work. We only check the retain count if - // we didn't get a new version. - if (val == oldVal) { - if (type == kGTMABIntegerPropertyType - || type == kGTMABRealPropertyType) { - // We are verifying that yes indeed 6208390 is still broken - XCTAssertEqual(fourthRetainCount, - thirdRetainCount, - @"Testing type %d, %@. If you see this error it may " - @"be time to update the code to change retain behaviors" - @"with this os version", type, val); - } else { - XCTAssertEqual(fourthRetainCount, - thirdRetainCount + 1, - @"Testing type %d, %@", type, val); - [val release]; - } - } else { - [val release]; - } - CFRelease(ref); - } -} - -#endif // (!defined(__LP64__) || !__LP64__) - -// Globals used by testRadar6240394. -static GTMABPropertyID gGTMTestID; -static const GTMABPropertyID *gGTMTestIDPtr; - -void __attribute__((constructor))SetUpIDForTestRadar6240394(void) { - // These must be set up BEFORE ABAddressBookCreate is called. - gGTMTestID = kGTMABPersonLastNameProperty; - gGTMTestIDPtr = &kGTMABPersonLastNameProperty; -} - -- (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. - XCTAssertEqual(gGTMTestID, 0, @"If this isn't zero, Apple has fixed 6240394"); - (void)ABAddressBookCreate(); - XCTAssertEqual(*gGTMTestIDPtr, kGTMABPersonLastNameProperty, - @"If this doesn't work, something else has broken"); -} - -#endif // GTM_IPHONE_SDK -@end diff --git a/AddressBook/TestData/phone.png b/AddressBook/TestData/phone.png deleted file mode 100644 index 7e4051f..0000000 Binary files a/AddressBook/TestData/phone.png and /dev/null differ diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj index f16f721..cbf9fd0 100644 --- a/GTM.xcodeproj/project.pbxproj +++ b/GTM.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 8207B89B0FEA7A9E008A527B /* GTMWindowSheetController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8207B8970FEA7A98008A527B /* GTMWindowSheetController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8207B89C0FEA7AA1008A527B /* GTMWindowSheetController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8207B8980FEA7A98008A527B /* GTMWindowSheetController.m */; }; 8207B89D0FEA7AA6008A527B /* GTMWindowSheetControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8207B8990FEA7A98008A527B /* GTMWindowSheetControllerTest.m */; }; - 8B07C60E1D99B01D0054728B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B07C60D1D99B01D0054728B /* XCTest.framework */; }; 8B07C60F1D99B01D0054728B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B07C60D1D99B01D0054728B /* XCTest.framework */; }; 8B07C6101D99B01D0054728B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B07C60D1D99B01D0054728B /* XCTest.framework */; }; 8B07C6111D99B01D0054728B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B07C60D1D99B01D0054728B /* XCTest.framework */; }; @@ -101,16 +100,6 @@ 8BF2369013CF67CB00F3FD82 /* GTMKeyValueAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BF2368E13CF67CB00F3FD82 /* GTMKeyValueAnimation.m */; }; 8BF2369213CF694C00F3FD82 /* GTMKeyValueAnimationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BF2369113CF694C00F3FD82 /* GTMKeyValueAnimationTest.m */; }; 8BF2555310F65B56000490C8 /* GTMTypeCasting.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BF2555110F65B56000490C8 /* GTMTypeCasting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8BFE13B60FB0F2C0001BE894 /* GTMABAddressBook.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BFE13B00FB0F2B9001BE894 /* GTMABAddressBook.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8BFE13B70FB0F2C0001BE894 /* GTMABAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BFE13B10FB0F2B9001BE894 /* GTMABAddressBook.m */; }; - 8BFE13ED0FB0F2D8001BE894 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; - 8BFE13EE0FB0F2D8001BE894 /* GoogleToolboxForMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F42E086D0D199A5B00D5DDE0 /* GoogleToolboxForMac.framework */; }; - 8BFE14C10FB0F333001BE894 /* GTMABAddressBookTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BFE13B30FB0F2B9001BE894 /* GTMABAddressBookTest.m */; }; - 8BFE158D0FB0F34C001BE894 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BFE158C0FB0F34C001BE894 /* AddressBook.framework */; }; - 8BFE158E0FB0F34C001BE894 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BFE158C0FB0F34C001BE894 /* AddressBook.framework */; }; - 8BFE15970FB0F3C9001BE894 /* GTMSenTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7DCE180DFF39850017E983 /* GTMSenTestCase.m */; }; - 8BFE17F40FB1F6E5001BE894 /* GTMABAddressBook.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE13B20FB0F2B9001BE894 /* GTMABAddressBook.strings */; }; - 8BFE17F50FB1F6EA001BE894 /* phone.png in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE13B50FB0F2B9001BE894 /* phone.png */; }; 8BFE6E7D1282371200B5C894 /* GTMFileSystemKQueueTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F49FA88A0EEF303D00077669 /* GTMFileSystemKQueueTest.m */; }; 8BFE6E7F1282371200B5C894 /* GTMGeometryUtilsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F48FE2800D198D0E009257D2 /* GTMGeometryUtilsTest.m */; }; 8BFE6E801282371200B5C894 /* GTMLightweightProxyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F41711340ECDFBD500B9B276 /* GTMLightweightProxyTest.m */; }; @@ -225,13 +214,6 @@ remoteGlobalIDString = 8BC85130127A18AE0046E0FB; remoteInfo = GTMServiceManagementHarness; }; - 8BFE13C00FB0F2D8001BE894 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F42E086C0D199A5B00D5DDE0; - remoteInfo = GTM; - }; F42E08760D199A9B00D5DDE0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -350,13 +332,6 @@ 8BF2368E13CF67CB00F3FD82 /* GTMKeyValueAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMKeyValueAnimation.m; sourceTree = ""; }; 8BF2369113CF694C00F3FD82 /* GTMKeyValueAnimationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMKeyValueAnimationTest.m; sourceTree = ""; }; 8BF2555110F65B56000490C8 /* GTMTypeCasting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMTypeCasting.h; sourceTree = ""; }; - 8BFE13B00FB0F2B9001BE894 /* GTMABAddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMABAddressBook.h; sourceTree = ""; }; - 8BFE13B10FB0F2B9001BE894 /* GTMABAddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMABAddressBook.m; sourceTree = ""; }; - 8BFE13B20FB0F2B9001BE894 /* GTMABAddressBook.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = GTMABAddressBook.strings; sourceTree = ""; }; - 8BFE13B30FB0F2B9001BE894 /* GTMABAddressBookTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMABAddressBookTest.m; sourceTree = ""; }; - 8BFE13B50FB0F2B9001BE894 /* phone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = phone.png; sourceTree = ""; }; - 8BFE13FC0FB0F2D8001BE894 /* UnitTest-AddressBook.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UnitTest-AddressBook.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 8BFE158C0FB0F34C001BE894 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = /System/Library/Frameworks/AddressBook.framework; sourceTree = ""; }; F413908C0D75F63C00F72B31 /* GTMNSFileManager+Path.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSFileManager+Path.h"; sourceTree = ""; }; F413908D0D75F63C00F72B31 /* GTMNSFileManager+Path.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSFileManager+Path.m"; sourceTree = ""; }; F413908E0D75F63C00F72B31 /* GTMNSFileManager+PathTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSFileManager+PathTest.m"; sourceTree = ""; }; @@ -494,17 +469,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 8BFE13EC0FB0F2D8001BE894 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8BFE13ED0FB0F2D8001BE894 /* Cocoa.framework in Frameworks */, - 8BFE13EE0FB0F2D8001BE894 /* GoogleToolboxForMac.framework in Frameworks */, - 8BFE158E0FB0F34C001BE894 /* AddressBook.framework in Frameworks */, - 8B07C60E1D99B01D0054728B /* XCTest.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; F42E081C0D19987200D5DDE0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -526,7 +490,6 @@ F42E09AE0D19A62F00D5DDE0 /* Carbon.framework in Frameworks */, F43E4F6D0D4E60C50041161F /* libz.dylib in Frameworks */, 8B4D78080E40AFFA00EFEDD8 /* QuartzCore.framework in Frameworks */, - 8BFE158D0FB0F34C001BE894 /* AddressBook.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -552,7 +515,6 @@ F42E086D0D199A5B00D5DDE0 /* GoogleToolboxForMac.framework */, 8B45A0280DA4696C001148C5 /* UnitTest-UnitTesting.xctest */, 8B45A28A0DA49B99001148C5 /* GTMUIUnitTestingHarness.app */, - 8BFE13FC0FB0F2D8001BE894 /* UnitTest-AddressBook.xctest */, 8BC85131127A18AE0046E0FB /* GTMServiceManagementTestingHarness */, ); name = Products; @@ -563,7 +525,6 @@ children = ( F440EDB70DFECC4B0003E81F /* BuildingAndUsing.txt */, 8B1A16050D90344B00CA1E8E /* GTMDefines.h */, - 8BFE13AF0FB0F2B9001BE894 /* AddressBook */, F48FE26F0D198CBA009257D2 /* AppKit */, F48FE2720D198CCE009257D2 /* Foundation */, F4FF22760D9D47FB003880AC /* DebugUtils */, @@ -583,7 +544,6 @@ 8B07C60D1D99B01D0054728B /* XCTest.framework */, 444B3B7619F6D24000B9191E /* CoreServices.framework */, 8BC851D3127A19020046E0FB /* CoreFoundation.framework */, - 8BFE158C0FB0F34C001BE894 /* AddressBook.framework */, F99161B40F0B151400213D3B /* libsqlite3.dylib */, 8B45A1990DA46AAA001148C5 /* QuartzCore.framework */, F43E4F6C0D4E60C50041161F /* libz.dylib */, @@ -641,26 +601,6 @@ path = TestData; sourceTree = ""; }; - 8BFE13AF0FB0F2B9001BE894 /* AddressBook */ = { - isa = PBXGroup; - children = ( - 8BFE13B00FB0F2B9001BE894 /* GTMABAddressBook.h */, - 8BFE13B10FB0F2B9001BE894 /* GTMABAddressBook.m */, - 8BFE13B20FB0F2B9001BE894 /* GTMABAddressBook.strings */, - 8BFE13B30FB0F2B9001BE894 /* GTMABAddressBookTest.m */, - 8BFE13B40FB0F2B9001BE894 /* TestData */, - ); - path = AddressBook; - sourceTree = ""; - }; - 8BFE13B40FB0F2B9001BE894 /* TestData */ = { - isa = PBXGroup; - children = ( - 8BFE13B50FB0F2B9001BE894 /* phone.png */, - ); - path = TestData; - sourceTree = ""; - }; F435E4840DC8F3DC0069CDE8 /* TestData */ = { isa = PBXGroup; children = ( @@ -935,7 +875,6 @@ 8B6C15930F356E6400E51E5D /* GTMNSObject+KeyValueObserving.h in Headers */, 7F511DF90F4B0378009F41B6 /* GTMNSColor+Luminance.h in Headers */, 8B40994B0F93C5CC00DF540E /* GTMUILocalizer.h in Headers */, - 8BFE13B60FB0F2C0001BE894 /* GTMABAddressBook.h in Headers */, 8BD35B910FB22980009058F5 /* GTMNSScanner+JSON.h in Headers */, 8207B89B0FEA7A9E008A527B /* GTMWindowSheetController.h in Headers */, F43C7A571021FAA300ABF03C /* GTMUILocalizerAndLayoutTweaker.h in Headers */, @@ -1005,24 +944,6 @@ productReference = 8BC85131127A18AE0046E0FB /* GTMServiceManagementTestingHarness */; productType = "com.apple.product-type.tool"; }; - 8BFE13BC0FB0F2D8001BE894 /* UnitTest-AddressBook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8BFE13F20FB0F2D8001BE894 /* Build configuration list for PBXNativeTarget "UnitTest-AddressBook" */; - buildPhases = ( - 8BFE13C10FB0F2D8001BE894 /* Resources */, - 8BFE13D70FB0F2D8001BE894 /* Sources */, - 8BFE13EC0FB0F2D8001BE894 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 8BFE13BF0FB0F2D8001BE894 /* PBXTargetDependency */, - ); - name = "UnitTest-AddressBook"; - productName = "UnitTest-AppKit"; - productReference = 8BFE13FC0FB0F2D8001BE894 /* UnitTest-AddressBook.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; F42E08110D19987200D5DDE0 /* UnitTest-Foundation */ = { isa = PBXNativeTarget; buildConfigurationList = F42E081E0D19987200D5DDE0 /* Build configuration list for PBXNativeTarget "UnitTest-Foundation" */; @@ -1121,7 +1042,6 @@ projectRoot = ""; targets = ( F42E086C0D199A5B00D5DDE0 /* GTM */, - 8BFE13BC0FB0F2D8001BE894 /* UnitTest-AddressBook */, F48FE2630D198C1E009257D2 /* UnitTest-AppKit */, F42E08110D19987200D5DDE0 /* UnitTest-Foundation */, 8B45A0270DA4696C001148C5 /* UnitTest-UnitTesting */, @@ -1149,15 +1069,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 8BFE13C10FB0F2D8001BE894 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8BFE17F40FB1F6E5001BE894 /* GTMABAddressBook.strings in Resources */, - 8BFE17F50FB1F6EA001BE894 /* phone.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; F42E08140D19987200D5DDE0 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1242,15 +1153,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 8BFE13D70FB0F2D8001BE894 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8BFE15970FB0F3C9001BE894 /* GTMSenTestCase.m in Sources */, - 8BFE14C10FB0F333001BE894 /* GTMABAddressBookTest.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; F42E08160D19987200D5DDE0 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1328,7 +1230,6 @@ 8B6C15940F356E6400E51E5D /* GTMNSObject+KeyValueObserving.m in Sources */, 7F511DFA0F4B0378009F41B6 /* GTMNSColor+Luminance.m in Sources */, 8B40994C0F93C5CC00DF540E /* GTMUILocalizer.m in Sources */, - 8BFE13B70FB0F2C0001BE894 /* GTMABAddressBook.m in Sources */, 8BD35B920FB22980009058F5 /* GTMNSScanner+JSON.m in Sources */, 8207B89C0FEA7AA1008A527B /* GTMWindowSheetController.m in Sources */, F43C7A581021FAA300ABF03C /* GTMUILocalizerAndLayoutTweaker.m in Sources */, @@ -1378,11 +1279,6 @@ target = 8BC85130127A18AE0046E0FB /* GTMServiceManagementTestingHarness */; targetProxy = 8BC8514E127A18B60046E0FB /* PBXContainerItemProxy */; }; - 8BFE13BF0FB0F2D8001BE894 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F42E086C0D199A5B00D5DDE0 /* GTM */; - targetProxy = 8BFE13C00FB0F2D8001BE894 /* PBXContainerItemProxy */; - }; F42E08770D199A9B00D5DDE0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = F42E086C0D199A5B00D5DDE0 /* GTM */; @@ -1469,20 +1365,6 @@ }; name = Debug; }; - F4CC9F2B148E5DEB00B7D68C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F48FE2420D197F9A009257D2 /* DebugUnittest.xcconfig */; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(value)", - "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", - ); - INFOPLIST_FILE = "UnitTest-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "UnitTest-AddressBook"; - }; - name = Debug; - }; F4CC9F2C148E5DEB00B7D68C /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = F48FE2420D197F9A009257D2 /* DebugUnittest.xcconfig */; @@ -1587,20 +1469,6 @@ }; name = Release; }; - F4CC9F36148E5DF700B7D68C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F48FE2450D197F9A009257D2 /* ReleaseUnittest.xcconfig */; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(value)", - "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", - ); - INFOPLIST_FILE = "UnitTest-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "UnitTest-AddressBook"; - }; - name = Release; - }; F4CC9F37148E5DF700B7D68C /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = F48FE2450D197F9A009257D2 /* ReleaseUnittest.xcconfig */; @@ -1701,15 +1569,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - 8BFE13F20FB0F2D8001BE894 /* Build configuration list for PBXNativeTarget "UnitTest-AddressBook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F4CC9F2B148E5DEB00B7D68C /* Debug */, - F4CC9F36148E5DF700B7D68C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; F42E081E0D19987200D5DDE0 /* Build configuration list for PBXNativeTarget "UnitTest-Foundation" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/GTMiPhone.xcodeproj/project.pbxproj b/GTMiPhone.xcodeproj/project.pbxproj index ac9bd50..75f3592 100644 --- a/GTMiPhone.xcodeproj/project.pbxproj +++ b/GTMiPhone.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ 8B7651D81D9C872F00DB2C59 /* GTMLogger+ASL.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7651D61D9C872C00DB2C59 /* GTMLogger+ASL.m */; }; 8B7651D91D9C873200DB2C59 /* GTMLogger+ASLTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7651D71D9C872C00DB2C59 /* GTMLogger+ASLTest.m */; }; 8B7651E11D9C89B800DB2C59 /* GTMRoundedRectPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7651E01D9C89B800DB2C59 /* GTMRoundedRectPath.m */; }; - 8B82CEFF1D9C1C3B007182AA /* GTMABAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BFE15C10FB0F764001BE894 /* GTMABAddressBook.m */; }; 8B82CF001D9C1C3B007182AA /* GTMDebugThreadValidation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BE839870E89C74A00C611B0 /* GTMDebugThreadValidation.m */; }; 8B82CF011D9C1C3B007182AA /* GTMMethodCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BC0479D0DAE928A00C2D1CA /* GTMMethodCheck.m */; }; 8B82CF021D9C1C3B007182AA /* GTMStringEncoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BBC768910FEF61D0006FABE /* GTMStringEncoding.m */; }; @@ -50,10 +49,6 @@ 8B82CF2C1D9C1CC5007182AA /* GTMStringEncodingTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BBC768A10FEF61D0006FABE /* GTMStringEncodingTest.m */; }; 8B82CF2E1D9C1DD4007182AA /* libGTM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B82CEF61D9C17DE007182AA /* libGTM.a */; }; 8B82CF2F1D9C1E49007182AA /* GTMSenTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BC047F70DAE928A00C2D1CA /* GTMSenTestCase.m */; }; - 8B82CF301D9C22F7007182AA /* GTMABAddressBook.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE15C20FB0F764001BE894 /* GTMABAddressBook.strings */; }; - 8B82CF311D9C22F7007182AA /* GTMABAddressBookTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BFE15C30FB0F764001BE894 /* GTMABAddressBookTest.m */; }; - 8B82CF321D9C2309007182AA /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B5A9E1F0E71CB6C005DA441 /* AddressBook.framework */; }; - 8B82CF331D9C231A007182AA /* phone.png in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE15C50FB0F764001BE894 /* phone.png */; }; 8B82CF341D9C231F007182AA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 8B82CF351D9C2353007182AA /* GTMMethodCheckTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BC0479E0DAE928A00C2D1CA /* GTMMethodCheckTest.m */; }; 8B82CF361D9C2373007182AA /* GTMGeometryUtilsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F439ADEF0DBD3C4000BE9B91 /* GTMGeometryUtilsTest.m */; }; @@ -92,8 +87,6 @@ 8BF753DB1D9DB3080010A295 /* GTMSQLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BF753DA1D9DB3080010A295 /* GTMSQLite.m */; }; 8BF753DD1D9DB30E0010A295 /* GTMSQLiteTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BF753DC1D9DB30E0010A295 /* GTMSQLiteTest.m */; }; 8BF753DF1D9DB3740010A295 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BF753DE1D9DB3740010A295 /* libsqlite3.tbd */; }; - 8BFE15C70FB0F764001BE894 /* GTMABAddressBook.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE15C20FB0F764001BE894 /* GTMABAddressBook.strings */; }; - 8BFE15C90FB0F764001BE894 /* phone.png in Resources */ = {isa = PBXBuildFile; fileRef = 8BFE15C50FB0F764001BE894 /* phone.png */; }; F4746721129703600022C1FB /* GTMSenTestCaseTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F4746720129703600022C1FB /* GTMSenTestCaseTest.m */; }; /* End PBXBuildFile section */ @@ -149,7 +142,6 @@ 8B3AA8F10E032FC7007E31B5 /* GTMNSString+URLArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSString+URLArguments.m"; sourceTree = ""; }; 8B3AA8F20E032FC7007E31B5 /* GTMNSString+URLArgumentsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSString+URLArgumentsTest.m"; sourceTree = ""; }; 8B3AA9330E0336AC007E31B5 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; - 8B5A9E1F0E71CB6C005DA441 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; 8B6C18710F3769D200E51E5D /* GTMNSObject+KeyValueObserving.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSObject+KeyValueObserving.h"; sourceTree = ""; }; 8B6C18720F3769D200E51E5D /* GTMNSObject+KeyValueObserving.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSObject+KeyValueObserving.m"; sourceTree = ""; }; 8B6C18730F3769D200E51E5D /* GTMNSObject+KeyValueObservingTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSObject+KeyValueObservingTest.m"; sourceTree = ""; }; @@ -210,11 +202,6 @@ 8BF753DA1D9DB3080010A295 /* GTMSQLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMSQLite.m; sourceTree = ""; }; 8BF753DC1D9DB30E0010A295 /* GTMSQLiteTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMSQLiteTest.m; sourceTree = ""; }; 8BF753DE1D9DB3740010A295 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; - 8BFE15C00FB0F764001BE894 /* GTMABAddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMABAddressBook.h; sourceTree = ""; }; - 8BFE15C10FB0F764001BE894 /* GTMABAddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMABAddressBook.m; sourceTree = ""; }; - 8BFE15C20FB0F764001BE894 /* GTMABAddressBook.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = GTMABAddressBook.strings; sourceTree = ""; }; - 8BFE15C30FB0F764001BE894 /* GTMABAddressBookTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMABAddressBookTest.m; sourceTree = ""; }; - 8BFE15C50FB0F764001BE894 /* phone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = phone.png; sourceTree = ""; }; 9340CF9C140550CE0026DDC9 /* GTMFadeTruncatingLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMFadeTruncatingLabel.h; sourceTree = ""; }; 9340CF9D140550CE0026DDC9 /* GTMFadeTruncatingLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMFadeTruncatingLabel.m; sourceTree = ""; }; 9340CF9E140550CE0026DDC9 /* GTMFadeTruncatingLabelTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMFadeTruncatingLabelTest.m; sourceTree = ""; }; @@ -270,7 +257,6 @@ buildActionMask = 2147483647; files = ( 8BF753DF1D9DB3740010A295 /* libsqlite3.tbd in Frameworks */, - 8B82CF321D9C2309007182AA /* AddressBook.framework in Frameworks */, 8B82CF661D9C3366007182AA /* XCTest.framework in Frameworks */, 8B82CF341D9C231F007182AA /* UIKit.framework in Frameworks */, 8B82CF511D9C239A007182AA /* Security.framework in Frameworks */, @@ -296,7 +282,6 @@ isa = PBXGroup; children = ( 8BC047750DAE926E00C2D1CA /* GTMDefines.h */, - 8BFE15BF0FB0F764001BE894 /* AddressBook */, 8BC0479A0DAE928A00C2D1CA /* DebugUtils */, 8BC047760DAE928A00C2D1CA /* Foundation */, 8BA5F4060E75669000798036 /* iPhone */, @@ -316,7 +301,6 @@ 8B82CEEE1D9C1559007182AA /* XCTest.framework */, 23220A05152C9E980060CB7D /* Security.framework */, 8B3AA9330E0336AC007E31B5 /* CFNetwork.framework */, - 8B5A9E1F0E71CB6C005DA441 /* AddressBook.framework */, 8B308BCD0DAD0B8400183556 /* QuartzCore.framework */, 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */, 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, @@ -503,26 +487,6 @@ path = Project; sourceTree = ""; }; - 8BFE15BF0FB0F764001BE894 /* AddressBook */ = { - isa = PBXGroup; - children = ( - 8BFE15C00FB0F764001BE894 /* GTMABAddressBook.h */, - 8BFE15C10FB0F764001BE894 /* GTMABAddressBook.m */, - 8BFE15C20FB0F764001BE894 /* GTMABAddressBook.strings */, - 8BFE15C30FB0F764001BE894 /* GTMABAddressBookTest.m */, - 8BFE15C40FB0F764001BE894 /* TestData */, - ); - path = AddressBook; - sourceTree = ""; - }; - 8BFE15C40FB0F764001BE894 /* TestData */ = { - isa = PBXGroup; - children = ( - 8BFE15C50FB0F764001BE894 /* phone.png */, - ); - path = TestData; - sourceTree = ""; - }; F435E49F0DC8F5290069CDE8 /* TestData */ = { isa = PBXGroup; children = ( @@ -629,8 +593,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8BFE15C70FB0F764001BE894 /* GTMABAddressBook.strings in Resources */, - 8BFE15C90FB0F764001BE894 /* phone.png in Resources */, 64D0F5DF0FD3E68400506CC7 /* GTMUIImage+Resize_50x100.png in Resources */, 64D0F5E60FD3E68400506CC7 /* GTMUIImage+Resize_100x50.png in Resources */, 64D0F5ED0FD3E68400506CC7 /* GTMUIImage+Resize_100x100.png in Resources */, @@ -642,8 +604,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8B82CF331D9C231A007182AA /* phone.png in Resources */, - 8B82CF301D9C22F7007182AA /* GTMABAddressBook.strings in Resources */, 8B82CF5B1D9C25E0007182AA /* GTMUIImage+Resize_50x100.png in Resources */, 8B82CF5A1D9C25E0007182AA /* GTMUIImage+Resize_100x50.png in Resources */, 8B82CF4B1D9C2373007182AA /* GTMUILocalizerTest.xib in Resources */, @@ -696,7 +656,6 @@ 8B82CF101D9C1C3B007182AA /* GTMNSString+URLArguments.m in Sources */, 8B82CF091D9C1C3B007182AA /* GTMNSDictionary+URLArguments.m in Sources */, 8B82CF061D9C1C3B007182AA /* GTMLoggerRingBufferWriter.m in Sources */, - 8B82CEFF1D9C1C3B007182AA /* GTMABAddressBook.m in Sources */, 8B82CF071D9C1C3B007182AA /* GTMNSArray+Merge.m in Sources */, 8B82CF131D9C1C3B007182AA /* GTMRegex.m in Sources */, 8B82CF0A1D9C1C3B007182AA /* GTMNSFileManager+Path.m in Sources */, @@ -718,7 +677,6 @@ 8B82CF4D1D9C2385007182AA /* GTMUIFont+LineHeightTest.m in Sources */, 8B82CF381D9C2373007182AA /* GTMLoggerTest.m in Sources */, 8B82CF3A1D9C2373007182AA /* GTMNSArray+MergeTest.m in Sources */, - 8B82CF311D9C22F7007182AA /* GTMABAddressBookTest.m in Sources */, 8B82CF2F1D9C1E49007182AA /* GTMSenTestCase.m in Sources */, 8B82CF4A1D9C2373007182AA /* GTMUILocalizerTest.m in Sources */, 8BF753DD1D9DB30E0010A295 /* GTMSQLiteTest.m in Sources */, -- cgit v1.2.3