0
我正嘗試在內部通訊簿中創建聯繫人。我的代碼如下:在Objective-C中創建iPhone聯繫人
#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
在CreateNewAccountPage.m文件:
#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
,我得到的錯誤是:
在CreateNewAccountPage.h文件「_OBJC_CLASS _ $ _ ABNewPersonViewController」,引用自: 在CreateNewAccountPage.o中的objc-class-ref-to-ABNewPersonViewController ld:sy MBOL(S)沒有發現 collect2:LD返回1退出狀態
如果我行註釋掉:
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
picker.newPersonViewDelegate = self;
...
[picker release];
我不再收到錯誤。我只是想要創建一個聯繫人。它不需要訪問聯繫人列表。我只想要一個按鈕來創建聯繫人。
非常感謝!
非常感謝! – Peter 2011-04-10 02:38:00