Alterplay / APAddressBook

Easy access to iOS address book
MIT License
1.38k stars 193 forks source link

fatal error: unexpectedly found nil while unwrapping an Optional value #95

Closed kafejo closed 9 years ago

kafejo commented 9 years ago

image

It happens when using filterBlock

let addressBook = APAddressBook()
addressBook.fieldsMask = [.CompositeName, .Emails, .Thumbnail]
addressBook.filterBlock = { contact in
    return contact.emails.count > 0
}

I've also tried using optional mark

contact.emails?.count > 0

Tell me if you need to provide more informations.

kafejo commented 9 years ago

Ok, I fixed it by adding another optional mark

contact?.emails?.count > 0