rso*_*son 2 iphone addressbook
我目前能够成功访问并从中获取数据peoplePickerNavigationController,但我想要做的是访问联系人的电子邮件地址,然后在按下联系人姓名时解除模态窗口.
场景:
"Button is clicked to add a contact
AddressBook Modal Window slides into view
Name of Contact is pressed
If available, the contact's email address is stored in an array
Dismiss modal window"
Run Code Online (Sandbox Code Playgroud)
我目前的代码包括:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
ABMultiValueRef container = ABRecordCopyValue(person, property);
CFStringRef contactData = ABMultiValueCopyValueAtIndex(container, identifier);
CFRelease(container);
NSString *contactString = [NSString stringWithString:(NSString *)contactData];
CFRelease(contactData);
NSLog(@"Value is: %@", contactString);
[self dismissModalViewControllerAnimated:YES];
return NO;
}
Run Code Online (Sandbox Code Playgroud)
这就是我做的.
if(property == kABPersonEmailProperty) {
CFTypeRef prop = ABRecordCopyValue(person, property);
CFIndex index = ABMultiValueGetIndexForIdentifier(prop, identifierForValue);
NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(prop, index);
...
CFRelease(prop);
[email release];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3705 次 |
| 最近记录: |