如果他们被选中,我试图让这个方法返回一个人。我的问题是我收到一条错误消息,指出委托不能返回void
令人讨厌的类型,因为我不希望此方法返回,除非发生这两个操作之一。有什么建议么?
public static ABPerson ImportContact ()
{
// Create placeholder for contact
ABPeoplePickerNavigationController _contactController = new ABPeoplePickerNavigationController ();
AppDelegate.navigation.PresentViewController (_contactController, true, null);
_contactController.Cancelled += delegate {
AppDelegate.navigation.DismissViewController (true, null);
return;
};
_contactController.SelectPerson += delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) {
_importedContact = e.Person.GetEmails().FirstOrDefault;
AppDelegate.navigation.DismissViewController (true, delegate {
return e.Person;
});
};
}