Objective c ABPersonViewControllerDelegate应为未工作的人员执行默认操作
由于某些原因,我的shouldPerformanceDefaultActionForPerson函数从未在模拟器和设备中被调用。有人能看看这个,告诉我我错过了什么吗?从我找到的所有例子中,我看不出我做错了什么 这是我的标题:Objective c ABPersonViewControllerDelegate应为未工作的人员执行默认操作,objective-c,ios,addressbook,abaddressbook,Objective C,Ios,Addressbook,Abaddressbook,由于某些原因,我的shouldPerformanceDefaultActionForPerson函数从未在模拟器和设备中被调用。有人能看看这个,告诉我我错过了什么吗?从我找到的所有例子中,我看不出我做错了什么 这是我的标题: #import <Foundation/Foundation.h> #import <AddressBookUI/AddressBookUI.h> #import <MessageUI/MessageUI.h> #import "SWO.
#import <Foundation/Foundation.h>
#import <AddressBookUI/AddressBookUI.h>
#import <MessageUI/MessageUI.h>
#import "SWO.h"
@interface CustomABPersonViewController : ABPersonViewController
<MFMessageComposeViewControllerDelegate, ABPersonViewControllerDelegate>
{
SWO *theSWO;
}
- (id)initWithSWO:(SWO *)aSWO;
@end
许多默认操作在模拟器上不起作用。您必须在实际设备上试用。如何测试它是否不起作用?您可以在我的代码中看到shouldPerformanceDefaultActionForPerson()正在登录“此处!”。无论是在模拟器还是设备中,当我尝试它时,它都不会出现在日志中。我也尝试过将设置返回到“否”,但无论属性类型如何,默认操作仍会发生。我一直在模拟器和设备上尝试,但没有效果。你真的点击了什么吗?
#import "CustomABPersonViewController.h"
#import <MessageUI/MessageUI.h>
#import "SWO.h"
@implementation CustomABPersonViewController
- (id)initWithSWO:(SWO *)aSWO
{
if (self = [super init])
{
//Various init code
}
return self;
}
- (BOOL)personViewController:(ABPersonViewController *)personView shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)IdentifierForValue
{
NSLog(@"In here!");
return YES;
}
@end
CustomABPersonViewController *view = [[CustomABPersonViewController alloc] initWithSWO:aSWO];
view.personViewDelegate = self;
view.displayedPerson = aRecord;
[self.navigationController setToolbarHidden:NO animated:NO];
[self.navigationController pushViewController:view animated:YES];