使用未声明的标识符PhonesViewController ios7 xCode

时间:2014-11-03 20:46:44

标签: iphone xcode ios7 addressbook

你能帮我解决一下这个错误吗? 基本上,我试图从我的地址簿中导入我的所有联系人列表。我也检查了电话号码标签,但我得到的错误是"使用未声明的标识符PhonesViewController ios7 xCode"我有viewController,我也在viewcontroller的storyboard中添加了类,虽然我认为没有必要 提前致谢

这是我的代码:

#import "PhonesViewController.h"

@implementation PhonesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    - (BOOL)PhohesViewController: (ABPeoplePickerNavigationController *)picker shouldContinueAfterSelectingPerson:(ABRecordRef)person
    {
        // Name of contact.

        NSString* name = (NSString *)ABRecordCopyCompositeName(person);

        // Numbers of selected contact

        ABMutableMultiValueRef phones = ABRecordCopyValue(person, kABPersonPhoneProperty);

        NSMutableString *mobile = [[NSMutableString alloc] init];
        NSMutableString *office = [[NSMutableString alloc] init];

        // Getting if Mobile, Office(work) numbers exist

        for(CFIndex numberIndex = 0; numberIndex < ABMultiValueGetCount(phones); numberIndex++)
        {
            // Number in contact details of current index

            CFStringRef phoneNumberRef = ABMultiValueCopyValueAtIndex(phones, numberIndex);

            // Label of Phone Number

            CFStringRef locLabel = ABMultiValueCopyLabelAtIndex(phones, numberIndex);
            NSString *phoneLabel =(NSString*) ABAddressBookCopyLocalizedLabel(locLabel);

            // Phone number

            NSString *phoneNumber = (NSString *)phoneNumberRef;

            // Release Phone Number and locationLabel reference object

            CFRelease(phoneNumberRef);
            CFRelease(locLabel);

            NSLog(@"  - %@ (%@)", phoneNumber, phoneLabel);

            if ([phoneLabel isEqualToString:@"mobile"])// Mobile number saving.
            {
                [mobile appendFormat:@"%@", phoneNumber];
            }
            else if ([phoneLabel isEqualToString:@"work"])// Office number saving.
            {
                [office appendFormat:@"%@", phoneNumber];
            }

            [phoneNumber release];
        }
        CFRelease(phones);

        // Emails of selected contact

        ABMutableMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);

        NSMutableString *generalMail = [[NSMutableString alloc] init];
        NSMutableString *officeMail = [[NSMutableString alloc] init];

        // Getting if Home, Office(work) mails exist

        for(CFIndex numberIndex = 0; numberIndex < ABMultiValueGetCount(emails); numberIndex++)
        {
            // Mail in contact details of current index

            CFStringRef mailRef = ABMultiValueCopyValueAtIndex(emails, numberIndex);

            // Label of Phone Number

            CFStringRef locLabel = ABMultiValueCopyLabelAtIndex(emails, numberIndex);
            NSString *mailLabel =(NSString*) ABAddressBookCopyLocalizedLabel(locLabel);

            // Phone number

            NSString *mail = (NSString *)mailRef;

            // Release Phone Number and locationLabel reference object

            CFRelease(mailRef);
            CFRelease(locLabel);
            NSLog(@"  - %@ (%@)", mail, mailLabel);

            if ([mailLabel isEqualToString:@"mobile"])// Home mail.
            {
                [generalMail appendFormat:@"%@", mail];
            }
            else if ([mailLabel isEqualToString:@"work"])// Office(Work) mail.
            {
                [officeMail appendFormat:@"%@", mail];
            }

            [mail release];
        }
        CFRelease(emails);

        [mobile release];
        [office release];

        [generalMail release];
        [officeMail release];

        [self dismissViewControllerAnimated:YES completion:nil];
        return NO;
    }

}

@end

2 个答案:

答案 0 :(得分:0)

看起来像是一个错字。

// Phohes?
- (BOOL)PhohesViewController: (ABPeoplePickerNavigationController *)picker //Phohes? shouldContinueAfterSelectingPerson:(ABRecordRef)person

答案 1 :(得分:0)

查看您的代码和您发布的图片,您在方法中定义了一种方法,但您无法做到这一点。