Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed people/groups. just using contacts

  • Loading branch information...
commit c41f1237dbd884a70d1b2e2222ee4c3587048f3f 1 parent 8f1b606
Erica Sadun authored
Showing with 4 additions and 19 deletions.
  1. +1 −3 ABContactsHelper.h
  2. +0 −14 ABContactsHelper.m
  3. +3 −2 main.m
View
4 ABContactsHelper.h
@@ -12,9 +12,7 @@
@interface ABContactsHelper : NSObject
// Address Book Contacts
-+ (NSArray *) contacts;
-+ (NSArray *) groups;
-+ (NSArray *) people;
++ (NSArray *) contacts; // people
// Counting
+ (int) contactsCount;
View
14 ABContactsHelper.m
@@ -18,20 +18,6 @@ + (NSArray *) contacts
return array;
}
-+ (NSArray *) people
-{
- NSArray *contacts = [ABContactsHelper contacts];
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"recordType == %d", kABPersonType];
- return [contacts filteredArrayUsingPredicate:pred];
-}
-
-+ (NSArray *) groups
-{
- NSArray *contacts = [ABContactsHelper contacts];
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"recordType == %d", kABGroupType];
- return [contacts filteredArrayUsingPredicate:pred];
-}
-
+ (int) contactsCount
{
ABAddressBookRef addressBook = ABAddressBookCreate();
View
5 main.m
@@ -92,7 +92,8 @@ - (void) addGW
// Relationships (Not actually used on the iPhone, but here for the sake of example)
NSMutableArray *relatedarray = [NSMutableArray array];
- [relatedarray addObject:[ABContact dictionaryWithValue:@"Ethel Washington" andLabel:kABPersonMotherLabel]];
+ [relatedarray addObject:[ABContact dictionaryWithValue:@"Mary Ball Washington" andLabel:kABPersonMotherLabel]];
+ [relatedarray addObject:[ABContact dictionaryWithValue:@"Augustine Washington" andLabel:kABPersonFatherLabel]];
peep.relatedNameDictionaries = relatedarray;
[ABContactsHelper addContact:peep]; // save to address book
@@ -100,7 +101,7 @@ - (void) addGW
- (void) scan
{
- for (ABContact *person in [ABContactsHelper people])
+ for (ABContact *person in [ABContactsHelper contacts])
{
printf("******\n");
printf("Name: %s\n", person.compositeName.UTF8String);
Please sign in to comment.
Something went wrong with that request. Please try again.