Reputation: 1
I am trying to create a contact in the internal address book. My code is as follows:
in the CreateNewAccountPage.h file:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
....
@interface CreateNewAccountPage : UIViewController <UIScrollViewDelegate,
UITextViewDelegate, MainMenuDelegate, ABNewPersonViewControllerDelegate> {
....
}
- (IBAction)goToContactCreation;
...
@end
In the CreateNewAccountPage.m file:
#import "CreateNewAccountPage.h"
@implementation CreateNewAccountPage
-(void)showNewPersonViewController
{
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
picker.newPersonViewDelegate = self;
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:picker];
[self presentModalViewController:navigation animated:YES];
[picker release];
[navigation release];
}
-(IBAction)goToContactCreation {
[self showNewPersonViewController];
}
- (void)newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person
{
[self dismissModalViewControllerAnimated:YES];
}
...
@end
The error that I am getting is:
"_OBJC_CLASS_$_ABNewPersonViewController", referenced from: objc-class-ref-to-ABNewPersonViewController in CreateNewAccountPage.o ld: symbol(s) not found collect2: ld returned 1 exit status
If I comment out the lines:
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
picker.newPersonViewDelegate = self;
...
[picker release];
I no longer receive the error. I am just trying to get a contact to be created. It doesn't have to do with accessing the contact list. I just want a button to create the contact.
Thanks so much!
Upvotes: 0
Views: 1018
Reputation: 4753
Add AddressBook.framework, AddressBookUI.framework frameworks to your project.
Upvotes: 3