Quote:
Originally Posted by airslim
The problem is that kABPersonFirstNameProperty is not an NSString, it has a type of ABPropertyID. I found another way to get around that by converting it to an NSNumber like:
Code:
NSNumber *property = [[NSNumber alloc] initWithInt:kABPersonBirthdayProperty];
but when I do:
Code:
ABRecordCopyValue(person, (ABPropertyID)property);
my app crashes. Any idea ?
|
ABPropertyID is an integer constant.
There's no converting it to a name. It's a constant defined using a #define somewhere in the headers of Apple's frameworks.
To find out the value, you can use a log statement like this
NSLog(@"constant ABPropertyID = %d", ABPropertyID);
You can't convert it to an NSNumber and then cast that NSNumber back to an ABPropertyID type, because then you are passing an object as if it is a constant value. You are passing bad data to the ABRecordCopyValue, so of course it crashes.