小编abd*_*rez的帖子

人们选择了ios 7和ios 8

我有人选择工作ios 7,我正在尝试添加ios 8的兼容性.我已经将两种方法添加到一个但是我得到一个错误,说明了预期的标识符或'('在NSString*contactName之前的开始括号上任何建议都会很棒!

- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
    [self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person property:property identifier:identifier];


    NSString *contactName = CFBridgingRelease(ABRecordCopyCompositeName(person));
    self.nameField.text = [NSString stringWithFormat:@"%@", contactName ? contactName : @"No Name"];


    ABMultiValueRef phoneRecord = ABRecordCopyValue(person, kABPersonPhoneProperty);
    CFStringRef phoneNumber = ABMultiValueCopyValueAtIndex(phoneRecord, 0);
    self.phoneField.text = (__bridge_transfer NSString *)phoneNumber;
    CFRelease(phoneRecord);


    ABMultiValueRef email = ABRecordCopyValue(person, kABPersonEmailProperty);
    CFStringRef emailField = ABMultiValueCopyValueAtIndex(email, 0);
    self.emailField.text = (__bridge_transfer NSString *)emailField;
    CFRelease(email);

    CFDataRef  photo = ABPersonCopyImageData(person);
    UIImage* image = [UIImage imageWithData:(__bridge NSData*)photo];
    if(photo)
        CFRelease(photo);
    if(image)
        self.myImageView.image = image;
    [self dismissViewControllerAnimated:YES completion:nil]; …
Run Code Online (Sandbox Code Playgroud)

objective-c abpeoplepickerview ios ios7 ios8

2
推荐指数
1
解决办法
5363
查看次数

标签 统计

abpeoplepickerview ×1

ios ×1

ios7 ×1

ios8 ×1

objective-c ×1