Re: [F-Script-talk] ABAddressBook problems
Brought to you by:
pmougin
From: Philippe M. <pm...@ac...> - 2004-04-30 18:12:55
|
Le 30 avr. 04, =E0 19:35, jcb a =E9crit : > Seems like this should work: > > leAddress :=3D ABAddressBook sharedAddressBook > > newPerson :=3D (ABPerson alloc) init > > newPerson setValue:'Kilgore' forProperty:kABFirstNameProperty > > newPerson setValue:'Trout' forProperty:kABLastNameProperty > > leAddress addPerson:newPerson > > error: an instance of ABAddressBook does not respond to "addPerson:" > Indeed, there is no addPerson: method defined on the ABAddressBook =20 class (as described in =20 http://developer.apple.com/documentation/UserExperience/Reference/=20 AddressBook/ObjC_classic/Classes/ABAddressBook.html). There is, however, an addRecord: method. This is probably what you want =20= to use. > > And this doesn't work either: > > newProps :=3D NSMutableDictionary dictionary > > newProps setObject:kABStringProperty forKey:'Favorite color' > > newProps setObject:kABStringProperty forKey:'College' > > newPerson addPropertiesAndTypes:newProps > > error: an instance of ABPerson does not respond to =20 > "addPropertiesAndTypes:" > > What am I doing wrong? > addPropertiesAndTypes: is a class method, not an instance method. You =20= can't invoke it on an instance of ABPerson, you are supposed to invoke =20= it on the ABPerson class itself. Best, Philippe Mougin |