alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

Issue with Person.all #28

Closed xbora closed 11 years ago

xbora commented 11 years ago

Hi there,

I'm getting the following error when I do -----> people = AddressBook::Person.all

person.rb:24:in block in all': wrong number of arguments (0 for 1) (ArgumentError) from person.rb:24:inall'

This works fine if I have one contact in the Simulator Contacts. But if I add another one, I get the above error. Any ideas?

Thanks, Bora

jmay commented 11 years ago

Bora- Do you get the same error if you try AddressBook::AddrBook.new.people?

xbora commented 11 years ago

No errors when I do that.

On Apr 22, 2013, at 4:01 PM, Jason May notifications@github.com wrote:

Bora- Do you get the same error if you try AddressBook::AddrBook.new.people?

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

jmay commented 11 years ago

Could you please paste your code that causes the error. I can't reproduce.

Also you could try the AddrBook API - which isn't documented yet.

   ab = AddressBook::AddrBook.new
   ab.create_person(:first_name => 'Bob', ...)
   ab.people
xbora commented 11 years ago

"people = AddressBook::AddrBook.new.people" works fine for me, but "people = AddressBook::Person.all" returns that error above. So I'll use the first option you just suggested, which fixes my problem. Thanks a lot!

jmay commented 11 years ago

Alex- The error that Bora reported above is occurring on the sort! line in Person#all. I don't see how that line could trigger this particular error. Any ideas?

alexrothenberg commented 11 years ago

I'm not sure but maybe its failing when calling the first_name or last_name method maybe because it gets a null looking up the ios constant in get_field(attribute_map[attribute_name]).

@xbora I can't reproduce this so could you please test what happens with

people = AddressBook::AddrBook.new.people
puts people.map(&:first_name)
puts people.map(&:last_name)
people.sort! { |a,b| "#{a.first_name} #{a.last_name}" <=> "#{b.first_name} #{b.last_name}" }

Thanks

xbora commented 11 years ago

Sure, just tried that block, and got

wrong number of arguments (0 for 1) (ArgumentError)

on the second line for mapping the first name.

On Apr 23, 2013, at 9:29 AM, Alex Rothenberg notifications@github.com wrote:

I'm not sure but maybe its failing when calling the first_name or last_name method maybe because it gets a null looking up the ios constant in get_field(attribute_map[attribute_name]).

@xbora I can't reproduce this so could you please test what happens with

people = AddressBook::AddrBook.new.people puts people.map(&:first_name) puts people.map(&:last_name) people.sort! { |a,b| "#{a.first_name} #{a.last_name}" <=> "#{b.first_name} #{b.last_name}" } Thanks

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

alexrothenberg commented 11 years ago

Could you please try these 4 commands so we can see where it breaks down

> people = AddressBook::AddrBook.new.people
  => [#<AddressBook::Person:0x10975840 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10974c20> @attributes=nil>, #<AddressBook::Person:0x10975970 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10965460> @attributes=nil>, #<AddressBook::Person:0x10975aa0 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10974ed0> @attributes=nil>, #<AddressBook::Person:0x10975bd0 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x109751f0> @attributes=nil>, #<AddressBook::Person:0x10975d00 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x109753a0> @attributes=nil>, #<AddressBook::Person:0x10975e30 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10975560> @attributes=nil>]

> AddressBook::Person.attribute_map[:first_name.to_sym]
  => 0

> ABRecordCopyValue(people.first.ab_person, 0)
  => "Kate"

> people.map {|person| ABRecordCopyValue(person.ab_person, 0) }
  => ["Kate", "Daniel", "John", "Anna", "Hank", "David"]
xbora commented 11 years ago

people = AddressBook::AddrBook.new.people => [#<AddressBook::Person:0x152e26d0 @address_book=#<__NSCFType:0x142df820> @ab_person=#<__NSCFType:0x13120320> @attributes=nil>, #<AddressBook::Person:0x152d00e0 @address_book=#<__NSCFType:0x142df820> @ab_person=#<__NSCFType:0x1314d3b0> @attributes=nil>, #<AddressBook::Person:0x13128ce0 @address_book=#<__NSCFType:0x142df820> @ab_person=#<__NSCFType:0x152906e0> @attributes=nil>]

AddressBook::Person.attribute_map[:first_name.to_sym] => 0

ABRecordCopyValue(people.first.ab_person, 0) => "Bora"

people.map {|person| ABRecordCopyValue(person.ab_person, 0) } => ["Bora", "Bora", "Bora"]

On Apr 23, 2013, at 10:50 AM, Alex Rothenberg notifications@github.com wrote:

Could you please try these 4 commands so we can see where it breaks down

people = AddressBook::AddrBook.new.people => [#<AddressBook::Person:0x10975840 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10974c20> @attributes=nil>, #<AddressBook::Person:0x10975970 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10965460> @attributes=nil>, #<AddressBook::Person:0x10975aa0 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10974ed0> @attributes=nil>, #<AddressBook::Person:0x10975bd0 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x109751f0> @attributes=nil>, #<AddressBook::Person:0x10975d00 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x109753a0> @attributes=nil>, #<AddressBook::Person:0x10975e30 @address_book=#<__NSCFType:0x109638b0> @ab_person=#<__NSCFType:0x10975560> @attributes=nil>]

AddressBook::Person.attribute_map[:first_name.to_sym] => 0

ABRecordCopyValue(people.first.ab_person, 0) => "Kate"

people.map {|person| ABRecordCopyValue(person.ab_person, 0) } => ["Kate", "Daniel", "John", "Anna", "Hank", "David"] — Reply to this email directly or view it on GitHub.

alexrothenberg commented 11 years ago

oh man that's not what i was expecting :(

I'd really like to be able to recreate this myself so I don't have to bug you with every little idea I have. Can you tell me how you created the 3 bora contacts? Also what version of ruby, rubymotion and the motion-addressbook gem are you using?

thanks again for your patience as I try to figure this out

xbora commented 11 years ago

No problem at all. Created 3 contacts manually in the Simulator Contacts. Attaching screenshots.

ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0] rubymotion 1.35 gem 'motion-addressbook', :git => 'git://github.com/alexrothenberg/motion-addressbook.git'

Screen Shot 2013-04-23 at 3 36 49 PM Screen Shot 2013-04-23 at 3 36 43 PM Screen Shot 2013-04-23 at 3 36 38 PM Screen Shot 2013-04-23 at 3 35 06 PM

alexrothenberg commented 11 years ago

I still can't reproduce.

I added a whole bunch of debug puts statements to the gem and created a test app. Could you please

clone https://github.com/alexrothenberg/address_book_bug run bundle run rake show me the output.

Hopefully some of the instrumentation will show us what's going on.

xbora commented 11 years ago

Sorry for the delay guys. Here is your logs below following the instructions above:

Create ./build/iPhoneSimulator-6.0-Development/address_book_bug.dSYM

Simulate ./build/iPhoneSimulator-6.0-Development/address_book_bug.app About to test Issue 28 ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 104, :method_missing, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 179, :get, :first_name, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 400, :import_ab_person] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 404, :import_ab_person, "about to get single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 0, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 1, :last_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 1] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 6, :middle_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 6] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 21, :suffix] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 21] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 19, :nickname] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 19] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 18, :job_title] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 18] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 11, :department] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 11] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 10, :organization] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 10] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 17, :birthday] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 17] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 14, :note] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 14] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 412, :import_ab_person, "got single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 15] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 417, :import_ab_person, "about to get multi value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 3, :phones] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 4, :emails] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 5, :addresses] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 22, :urls] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 46, :social_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 13, :im_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 23, :related_names] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 12, :dates] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 426, :import_ab_person, "got multi value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 104, :method_missing, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 179, :get, :first_name, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 400, :import_ab_person] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 404, :import_ab_person, "about to get single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 0, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 1, :last_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 1] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 6, :middle_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 6] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 21, :suffix] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 21] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 19, :nickname] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 19] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 18, :job_title] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 18] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 11, :department] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 11] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 10, :organization] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 10] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 17, :birthday] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 17] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 14, :note] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 14] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 412, :import_ab_person, "got single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 15] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 417, :import_ab_person, "about to get multi value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 3, :phones] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 4, :emails] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 5, :addresses] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 22, :urls] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 46, :social_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 13, :im_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 23, :related_names] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 12, :dates] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 426, :import_ab_person, "got multi value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 104, :method_missing, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 179, :get, :first_name, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 400, :import_ab_person] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 404, :import_ab_person, "about to get single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 0, :first_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 0] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 1, :last_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 1] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 6, :middle_name] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 6] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 21, :suffix] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 21] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 19, :nickname] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 19] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 18, :job_title] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 18] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 11, :department] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 11] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 10, :organization] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 10] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 17, :birthday] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 17] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 406, :import_ab_person, " ", 14, :note] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 14] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 412, :import_ab_person, "got single value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 437, :get_field, 15] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 417, :import_ab_person, "about to get multi value properties"] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 3, :phones] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 4, :emails] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 5, :addresses] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 22, :urls] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 46, :social_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 13, :im_profiles] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 23, :related_names] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 419, :import_ab_person, " ", 12, :dates] ["/Users/xbora/.rvm/gems/ruby-1.9.2-p290/bundler/gems/motion-addressbook-82b5e3e589e1/motion/address_book/person.rb", 426, :import_ab_person, "got multi value properties"] Bora Bora Bora (main)> 2013-04-25 20:21:56.820 address_book_bug[97080:c07] app_delegate.rb:11:in test_issue_28': undefined methodmap' for nil:NilClass (NoMethodError) from app_delegate.rb:3:in application:didFinishLaunchingWithOptions:' Got exception undefined methodmap' for nil:NilClass app_delegate.rb:11:in test_issue_28' app_delegate.rb:3:inapplication:didFinishLaunchingWithOptions:'

xbora commented 11 years ago

Also guys is there a way to get the photo of a contact from address book?

alexrothenberg commented 11 years ago

For the photo person.photo will give you the NSData of the photo back in the unreleased 1.3 version of the gem it might give a UIImage back #30 or we may add a new method photo_image to not break any existing code.

I'm still confused with the log. Since you got the three first names "bora bora bora" it seems like puts AddressBook::AddrBook.new.people.map &:first_name worked which is almost the same thing that wasn't working for you 3 days ago from your comment "Sure, just tried that block, and got wrong number of arguments (0 for 1) (ArgumentError) on the second line for mapping the first name.".

Could you please try that old test again.

xbora commented 11 years ago

Just tried again

people = AddressBook::Person.all

and got the

`block in all': wrong number of arguments (0 for 1) (ArgumentError)

The other way:

ab = AddressBook::AddrBook.new.people

works perfectly fine. So this is not a problem for me any more. I've also been able to get the photos in there thanks to your tip.

On Apr 26, 2013, at 12:27 PM, Alex Rothenberg notifications@github.com wrote:

For the photo person.photo will give you the NSData of the photo back in the unreleased 1.3 version of the gem it might give a UIImage back #30 or we may add a new method photo_image to not break any existing code.

I'm still confused with the log. Since you got the three first names "bora bora bora" it seems like puts AddressBook::AddrBook.new.people.map &:first_name worked which is almost the same thing that wasn't working for you 3 days ago from your comment "Sure, just tried that block, and got wrong number of arguments (0 for 1) (ArgumentError) on the second line for mapping the first name.".

Could you please try that old test again.

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

alexrothenberg commented 11 years ago

I'm glad you've got it working with the other api. I'll just leave this issue be since I can't reproduce it on my end and its not holding you up. Hopefully someday we'll figure out what the bug is and find a solution but for now its just a mystery.

alexrothenberg commented 11 years ago

Closing this issue for now as @xbora has a work around