The app I'm currently working on has to retrieve the ABRecord of a contact using a delegate, since the table for all the associated contacts of an object is in a container view. So far everything works, the only problem is that when I try to retrieve the record again after moving backwards from the AddressBook View Controller the app crashes. Here's a screenshot of the error and the code:
The Code
func showContactInterface(contacto: AnyObject) {
print(self.addressBookRef)
let peopleViewController = ABPersonViewController()
let recordID:ABRecordID = (((contacto as! Contacto).valueForKey("recordRef")?.intValue) as ABRecordID?)!
var recordRef:ABRecordRef? = ABAddressBookGetPersonWithRecordID(self.addressBookRef, recordID).takeRetainedValue()
peopleViewController.displayedPerson = recordRef!
self.navigationController?.pushViewController(peopleViewController, animated: true)
}