2014-11-03 15 views
0

你能幫我解決這個錯誤,我越來越... 基本上,我試圖從我的地址簿中導入我的所有聯繫人列表。此外,我正在檢查電話號碼標籤,但是我得到的錯誤是「使用未聲明的標識符PhonesViewController ios7 xCode」,並且我擁有該viewController,並且還在視圖控制器的storyboard中添加了該類,儘管我認爲沒有必要 預先感謝使用未聲明的標識PhonesViewController ios7 xCode

這裏是我的代碼:

#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 

回答

0

看起來像一個錯字給我。

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

這不是錯字.. [link](http://tinypic.com/view.php?pic=11si33r&s=8#.VFftQvTF_ZU) – 2014-11-03 21:02:31

0

看着你的代碼和你發佈的圖片,你正在定義一個方法,你不能這樣做。

相關問題