alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

first_name and last_name always have the same value #17

Closed spnkr closed 11 years ago

spnkr commented 11 years ago

With iOS 6 simulator (w/ default settings) first_name and last_name always have the same value:

=> AddressBook::Person.all

[#<AddressBook::Person:0xbadafe0 @attributes={:first_name=>"Anna", :last_name=>"Anna", ...>, #<AddressBook::Person:0xbad1370 @attributes={:first_name=>"Daniel", :last_name=>"Daniel",...>, ...

alexrothenberg commented 11 years ago

That looks bad, but I can't reproduce it on my end. Can you try running this script from the repl which makes the Apple api calls directly.

@error = nil
address_book = ABAddressBookCreateWithOptions(nil, @error)
ab_people = ABAddressBookCopyArrayOfAllPeople(address_book)
person = ab_people.first
puts ABRecordCopyValue(person, KABPersonFirstNameProperty)
puts ABRecordCopyValue(person, KABPersonLastNameProperty)

For me that gives me the correct first and last names of my first contact. What do you get?

spnkr commented 11 years ago

I'll try this soon, thx!

On Mar 15, 2013, at 8:15 AM, Alex Rothenberg notifications@github.com wrote:

That looks bad, but I can't reproduce it on my end. Can you try running this script from the repl which makes the Apple api calls directly.

@error = nil address_book = ABAddressBookCreateWithOptions(nil, @error) ab_people = ABAddressBookCopyArrayOfAllPeople(address_book) person = ab_people.first puts ABRecordCopyValue(person, KABPersonFirstNameProperty) puts ABRecordCopyValue(person, KABPersonLastNameProperty) For me that gives me the correct first and last names of my first contact. What do you get?

— Reply to this email directly or view it on GitHub.

spnkr commented 11 years ago

Looks to work fine now, I made a brand new motion app and no problems. motion and xcode were updated in the meantime, so I don't know what the problem was, but it's gone!