Closed kevinlieser closed 7 years ago
Sorry, but we didn't check APAddressBook
compatibility with Swift 3.0. I'll do it after XCode 8 release.
iOS 10: You need to put the NSContactsUsageDescription in your plist. Like:
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) uses contact list</string>
See all usage descriptions here.
I've already made that change but I still got the same issue as @kevinlieser
Did you actually make it work this way ? I've maybe done something wrong :/
I've defined the plist setting for NSContactsUsageDescription, too. Not working at all. A simple test with the new Contact Framework reads this setting, too. And it works.
U should use correct code:
self.addressBook.loadContacts { (contacts: [APContact]?, error: Error?) in
if let uwrappedContacts = contacts {
// do something with contacts
}
else if let unwrappedError = error {
// show error
}
}
sorry, but I create new project in xcode 8, and add via pods this framework, and use example from main page, where I got an error. Xcode trying to update code like in ur example, with
} as! APLoadContactsBlock)
but after build&run I have a crash with Thead 1: EXC_BAD_INSTRUCTION (code=EXC_I386...
Its mean inside exception
but if u try to add loadContacts function with completion block use xcode "intellisense" u will see a difference.
PS: I use this library in objective-c project, and Im trying to help with this issue.
@adman44: You code works like a charm. Thanks a lot! I've deleted my nonsense comment :-)
@adman44 Thanks you. This helps me, I got a sigabrt error when requesting access
@adman44 thanks! your code worked perfectly.
Check out new release - 0.3.0 I've removed type aliases in callbacks. Know it should work better with xcode's Swift3 autocomplete
I am trying to fetch the contacts as always (same as your Swift example):
But it exits with "Thread 1: EXC_BREAKPOINT (EXC_ARM_BREAKPOINT)". Anybody get that to work?