From: Patrick H. <ph...@gm...> - 2007-12-31 14:50:54
|
Thanks for the assistance, I have a followup question, which (to me at least) appears to be a RubyCocoa question, but is probably my lack of understanding of Cocoa. I am now trying to update addresses in the Address Book using RubyCocoa. I have the following code, which based on my reading of the documentation, I though would work, but alas no luck. require 'osx/cocoa' include OSX OSX.require_framework "AddressBook" me = ABAddressBook.sharedAddressBook.me # => #<OSX::ABPerson:0xbf9a0 class='ABPerson' id=0x536ef0> addrs = me.valueForProperty("Address") # => #<OSX::ABMultiValueCoreDataWrapper:0xbf5d6 class='ABMultiValueCoreDataWrapper' id=0x53b330> addr = addrs.valueAtIndex(0) # => #<OSX::NSCFDictionary:0xbf22a class='NSCFDictionary' id=0x53fe30> addr["Street"] = "1234 Anystreet" # => "1234 Anystreet" addr["Street"].to_s # => "1234 Anystreet" addrs.replaceValueAtIndex_withValue(0, addr) # => OSX::OCMessageSendException: Can't get Objective-C method signature for selector 'replaceValueAtIndex:withValue:' of receiver #<OSX::ABMultiValueCoreDataWrapper:0x1f2f2 class='ABMultiValueCoreDataWrapper' id=0x51e640> # ab.save Any help would be very appreciated, Happy New Year pth On Dec 24, 2007 1:57 AM, Satoshi Nakagawa <sna...@in...> wrote: > Hi, > > The value comes from a constant, kABHomeLabel. > > http://developer.apple.com/documentation/UserExperience/Reference/AddressBook/Classes/ABPerson_Class/Reference/Reference.html > > Proof: > > require 'osx/cocoa' > include OSX > OSX.require_framework "AddressBook" > puts KABWorkLabel > puts KABHomeLabel > puts KABOtherLabel > > Result: > > _$!<Work>!$_ > _$!<Home>!$_ > _$!<Other>!$_ > > -- > Satoshi Nakagawa > > > On 2007/12/24, at 7:04, Patrick Hurley wrote: > > > This is probably more of a cocoa question than a rubycocoa question, > > so feel free to ignore me :-) I am trying to work with address book, > > and at least at the moment I am stumped by labels in > > AbMultiValueCoreDataWrapper. I expect to see "Home", but I get > > "_$<Home>!$_". > > > > Thanks for any help, pointers to docs, etc. > > pth > > > > > > require 'osx/cocoa' > > include OSX > > OSX.require_framework "AddressBook" > > > > me = ABAddressBook.sharedAddressBook.me # => > > #<OSX::ABPerson:0xbf3d8 class='ABPerson' id=0x514af0> > > addr_info = me.valueForProperty("Address") # => > > #<OSX::ABMultiValueCoreDataWrapper:0xbf04a > > class='ABMultiValueCoreDataWrapper' id=0x51f0e0> > > addr_info.labelAtIndex(0).to_s # => "_$!<Home>!$_" > > addr_info.identifierAtIndex(0).to_s # => > > "E2E83CDE-3FE3-4F89-9EBD-1030C483A6D8" > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2005. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Rubycocoa-talk mailing list > > Rub...@li... > > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > |