1

I want to read the name of an ABSource in the addressBook framework. Is this possible? The following code sample leaves me with null, while the currentSource pointer is valid.

        NSString* stringName = (NSString*)ABRecordCopyValue(currentSource, kABSourceNameProperty); 

Thank you in advance, Martin

Martin Reichl
  • 932
  • 9
  • 13

1 Answers1

1
NSString *sourceTypeName = (NSString *)((CFStringRef)ABRecordCopyValue(source, kABSourceNameProperty));


ABSourceType sourceType = [(NSNumber *)ABRecordCopyValue(currentSource, kABSourceTypeProperty) intValue];

See ABSourceType for values.

Michaël
  • 6,676
  • 3
  • 36
  • 55
  • Thanks for the answer. But with your example, I'm only getting the type of the source. I'm in the situation that a user has two exchange sources and has to select the right one. For this, it would be nice to display the name of the source as it appears in the phone settings, rather than an index value. – Martin Reichl Mar 22 '11 at 10:02
  • Sorry, I have added the name property to my code. I think that you missed the CFStringRef cast. – Michaël Mar 22 '11 at 10:09