How to get the username value only from the addressbook, when selecting a twitter detail of contact
if ( property == kABPersonSocialProfileProperty) {
ABMultiValueRef multi = ABRecordCopyValue(person, property);
for (CFIndex i = 0; i < ABMultiValueGetCount(multi); i++) {
CFStringRef socialLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(multi, identifier));
CFStringRef social = ABMultiValueCopyValueAtIndex(multi, i);
NSDictionary* personaddress =(NSDictionary*) ABMultiValueCopyValueAtIndex(multi, i);
NSString*twitterdetails = [personaddress valueForKey:(NSString *)kABPersonSocialProfileServiceTwitter];
NSLog(@"%@ twitterdetails",twitterdetails);
NSString *aString = (NSString *)social;
NSLog(@"%@ aString",aString);
}
I am getting the result as below
{
service = twitter;
url = "http://twitter.com/manoas2136";
username = manoas2136;
} aString
please tell me how to get only the username from the above result set
try this code
result manoas2136 aString
you converted the NSDictionary value in to string so it clubbed all result of NSDictionary to NSString so you extract only username by using valueForKey: