SHARE
TWEET

New View Controller Snippet

a guest Jul 8th, 2014 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Instantiate our address book instance
  2.     self.addressBook = [[HALAddressBook alloc]init];
  3.    
  4.     // Instantiate our contact instance
  5.     self.currentContact = [[HALContact alloc]init];
  6.    
  7.     //Ask for access to Address Book.
  8.     BOOL result = [self.addressBook requestAccess];
  9.    
  10.     if (!result) {
  11.         [self performSegueWithIdentifier:@"addFriendsToMediaCaptureSegue" sender:self];
  12.     }
  13.  
  14.     if (result) {
  15.        
  16.         // Loop through all address book contacts
  17.         for (int index = 0; index < self.addressBook.allContacts.count; index++) {
  18.            
  19.            // Create contactRef from current contact
  20.             self.currentContact.contactRef = (__bridge ABRecordRef)(self.addressBook.allContacts[index]);
  21.            
  22.           // Loop through all of the current contact's phone numbers
  23.             int index2;
  24.             for (index2 = 0; index2 < self.currentContact.phoneNumbers.count; index2++) {
  25.             if (self.currentContact.firstName) {
  26.                
  27.                 // Add current contact's phone number to array
  28.                 [self.potentiaFriendsPhoneNumberArray addObject:self.currentContact.phoneNumbers[index2]];
  29.                
  30.                 // Add current contact's first name to array
  31.                 [self.potentiaFriendsNotInParseFirstNamesArray addObject:self.currentContact.firstName];
  32.             }
  33.         }
  34.         }
  35.       }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top