Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Instantiate our address book instance
- self.addressBook = [[HALAddressBook alloc]init];
- // Instantiate our contact instance
- self.currentContact = [[HALContact alloc]init];
- //Ask for access to Address Book.
- BOOL result = [self.addressBook requestAccess];
- if (!result) {
- [self performSegueWithIdentifier:@"addFriendsToMediaCaptureSegue" sender:self];
- }
- if (result) {
- // Loop through all address book contacts
- for (int index = 0; index < self.addressBook.allContacts.count; index++) {
- // Create contactRef from current contact
- self.currentContact.contactRef = (__bridge ABRecordRef)(self.addressBook.allContacts[index]);
- // Loop through all of the current contact's phone numbers
- int index2;
- for (index2 = 0; index2 < self.currentContact.phoneNumbers.count; index2++) {
- if (self.currentContact.firstName) {
- // Add current contact's phone number to array
- [self.potentiaFriendsPhoneNumberArray addObject:self.currentContact.phoneNumbers[index2]];
- // Add current contact's first name to array
- [self.potentiaFriendsNotInParseFirstNamesArray addObject:self.currentContact.firstName];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement