alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

Fix for access request on iOS 6 #12

Closed rainux closed 11 years ago

rainux commented 11 years ago

There are 2 issues cause apps use motion-addressbook crash on iOS 6 devices, they got fixed in 2 commits separately.

Now request access manually works properly on iOS 6, however the simplest usage people = AddressBook::Person.all still raise exception if user decide to not allow access, since call to ABAddressBookCopyArrayOfAllPeople on this line https://github.com/alexrothenberg/motion-addressbook/blob/master/motion/address_book/person.rb#L17 will return nil.

Maybe in README we should suggest developers to use manual way only.

alexrothenberg commented 11 years ago

Thanks for this fix.

I wonder what should happen in the people = AddressBook::Person.all case where the user does not grant access. I can imagine it

  1. returning nil
  2. return an empty list
  3. raising an exception

I think 2 sounds best to me. WDYT?

rainux commented 11 years ago

I think 2 sounds best too. To implement it looks like we should change https://github.com/alexrothenberg/motion-addressbook/blob/master/motion/address_book/person.rb#L17 to return [] if call to ABAddressBookCopyArrayOfAllPeople returns nil.

alexrothenberg commented 11 years ago

Do you want to make the fix to https://github.com/alexrothenberg/motion-addressbook/blob/master/motion/address_book/person.rb#L17 ?

rainux commented 11 years ago

OK, I'll send the pull request.

alexrothenberg commented 11 years ago

I merged your pull #13 so AddressBook::Person.all returns [] when not authorized.

Thanks