Using an NSString to refer to a variable
Using an NSString to refer to a variable
- Subject: Using an NSString to refer to a variable
- From: René Lepage <email@hidden>
- Date: Wed, 5 Nov 2003 17:16:12 -0500
Hello there.
Is there a way to enforce a NSString that refers to the name of a
constant to return a string?
I work within the AddressBook Framework and I want to set an ABPerson
value. I use :
[aPerson setValue:aValue forProperty:aProperty];
where "aValue" is a NSString and "aProperty" is another NSString (that
comes from an array) set to "kABFirstNameProperty", for instance. It
doesn't work. It works only if I write explicitly a valid property like
this :
[aPerson setValue:aValue forProperty: kABFirstNameProperty]
I doubt it is possible since it depends on the implementation of
setValue. What puzzles me is that if I NSlog(@"%@", aProperty), I get
"kABFirstNameProperty" while if I use it within setValue, I get an
error message like :
*** Assertion failure in -[ABPerson nts_SetValue:forProperty:],
Framework/AddressBook/ABRecord.m:386
Unknown property 'Michhle' type '-1608948992
Any suggestion or comment someone? It would be appreciate.
Reni Lepage
Quibec
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.