alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

crash after taking back list of contact #82

Open xikimay opened 9 years ago

xikimay commented 9 years ago

Hi,

I'm having trouble with motion-adressbook. When i'm getting back all my adressbook, thing that i success, my app crash just after.

stop reason = EXC_BAD_ACCESS

Here the part of my code:

    if AddressBook.request_authorization do |granted|
         if granted
             AddressBook::AddrBook.new do |ab|
                 if ab.people
                     people = ab.people.map(&:attributes) 
                     block.call people 
                 end 
             end
              else 
                  ........  

I manage to get all my adressbook but this line is making my app crash, i don't know why.

people = ab.people.map(&:attributes)

Anyone can explain me why ? and how to fix it ?

EDIT: It happens only on iOS 9 device, iOS 8.4 device works fine

carlinisaacson commented 9 years ago

I'm having the same issue. It appears that Apple deprecated the Address Book API in iOS 9 in favor of the Contacts API. Which means that if this gem isn't updated to support both then we will likely have to check the iOS version and handle contacts differently for 8 vs 9.