iosswiftdelegatesaddressbookpeoplepicker

Cannot find protocol declaration for 'ABPeoplePickerNavigationControllerDelegate'


In a Project having already ObjC, I'm adding a Swift Class

import AddressBookUI
class MyVC : UITableViewController, ABPeoplePickerNavigationControllerDelegate {
}

MyApp-Swift.h:289:42: Cannot find protocol declaration for 'ABPeoplePickerNavigationControllerDelegate'; did you mean 'UINavigationControllerDelegate'?

No, Swift, I really mean ABPeoplePickerNavigationControllerDelegate. Really wondering what I am doing wrong here...


Solution

  • FWIW, the reason this works with ABRecord in pure Swift, but not in the Objective-C compatibility header is that there is a typealias which the latter apparently doesn't translate back correctly:

    typealias ABRecordRef = ABRecord

    see https://developer.apple.com/library/prerelease/ios/documentation/AddressBook/Reference/ABRecordRef_iPhoneOS/index.html#//apple_ref/c/tdef/ABRecordRef

    Might be worth filing a Radar 📡