Kodeco Forums

Address Book Tutorial in Swift and iOS

In this Address Book Tutorial for iOS, learn how to add, edit and display contacts in a fun app about pets.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1786-address-book-tutorial-in-swift-and-ios

I used Xcode version 11.1 and IOS deployment target as 8.0
When i use address book, the app crashes with a build error @property with strong or retain must be object type. I donโ€™t know how to solve this. please help me

It is possible to display contacts in swift. But some times i got error in my -swift.h file that @property AddressBookRef must contain object type

It run well on the simulators, but when I run on my iPhone 6 plus, tapped the cat, it crashed with the following message:
Authorized
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb)

Greetings,

It issues with Optional value of ABAddressBook. Make it optional and problem will be solved.

let addressBookRef : ABAddressBook? = ABAddressBookCreateWithOptions(nil, nil)?.takeRetainedValue()

Thank you

Is it normal if the app crashes when you donโ€™t give it permission and then it asks you to change your permission settings, and navigates you to your settings page, and when you click to give it permission, the app crashes?

@thomasbaldwin Yes, itโ€™s normal. After user changes any of the App permissions in settings App is force closed and restarts.

Hey โ€ฆ can du make this for macOS ? i cant find any help on how get data from ABPeoplePickerView :smiley:

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]