diff --git a/Classes/APContact.h b/Classes/APContact.h index 52eb3ff..ec3d4de 100644 --- a/Classes/APContact.h +++ b/Classes/APContact.h @@ -14,6 +14,7 @@ @property (nonatomic, readonly) APContactField fieldMask; @property (nonatomic, readonly) NSString *firstName; +@property (nonatomic, readonly) NSString *middleName; @property (nonatomic, readonly) NSString *lastName; @property (nonatomic, readonly) NSString *compositeName; @property (nonatomic, readonly) NSString *company; diff --git a/Classes/APContact.m b/Classes/APContact.m index 123a042..3b0fafc 100644 --- a/Classes/APContact.m +++ b/Classes/APContact.m @@ -24,6 +24,10 @@ - (id)initWithRecordRef:(ABRecordRef)recordRef fieldMask:(APContactField)fieldMa { _firstName = [self stringProperty:kABPersonFirstNameProperty fromRecord:recordRef]; } + if (fieldMask & APContactFieldMiddleName) + { + _middleName = [self stringProperty:kABPersonMiddleNameProperty fromRecord:recordRef]; + } if (fieldMask & APContactFieldLastName) { _lastName = [self stringProperty:kABPersonLastNameProperty fromRecord:recordRef]; diff --git a/Classes/APTypes.h b/Classes/APTypes.h index e88dcf8..d26d172 100644 --- a/Classes/APTypes.h +++ b/Classes/APTypes.h @@ -35,6 +35,7 @@ typedef NS_OPTIONS(NSUInteger , APContactField) APContactFieldRecordID = 1 << 10, APContactFieldCreationDate = 1 << 11, APContactFieldModificationDate = 1 << 12, + APContactFieldMiddleName = 1 << 13, APContactFieldDefault = APContactFieldFirstName | APContactFieldLastName | APContactFieldPhones, APContactFieldAll = 0xFFFF diff --git a/README.md b/README.md index adcafad..5d17007 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ APAddressBook *addressBook = [[APAddressBook alloc] init]; ###### Select contact fields bit-mask Available fields: * APContactFieldFirstName - *contact first name* +* APContactFieldMiddleName - *contact middle name* * APContactFieldLastName - *contact last name* * APContactFieldCompany - *contact company (organization)* * APContactFieldPhones - *contact phones array*