Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set RHMultiDictionaryValue? #27

Closed
haemi opened this issue May 8, 2013 · 2 comments
Closed

How to set RHMultiDictionaryValue? #27

haemi opened this issue May 8, 2013 · 2 comments

Comments

@haemi
Copy link

haemi commented May 8, 2013

this doesn't work, unfortunately:

[socialProfiles addValue:@"myKey" withLabel:RHPersonSocialProfileServiceKey];
[socialProfiles addValue:@"myValue" withLabel:RHPersonSocialProfileUsernameKey]

I'm looking for a replacement for

    ABMultiValueRef social = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);
    {
        CFStringRef valueCFString = (__bridge CFStringRef) value;
        CFStringRef keys[] = {
                kABPersonSocialProfileServiceKey,
                kABPersonSocialProfileUsernameKey
        }, values[] = {
                CFSTR("myKey"),
                CFSTR("myValue")
        };

        ABMultiValueAddValueAndLabel(social, CFDictionaryCreate(kCFAllocatorDefault, (void *) keys, (void *) values, 3, NULL, NULL), NULL, NULL);
    }

    CFErrorRef error;
    ABRecordSetValue(rhPerson.recordRef, kABPersonSocialProfileProperty, social, &error);

    CFRelease(social);

thanks a LOT!

@heardrwt
Copy link
Owner

heardrwt commented May 8, 2013

socialProfiles can be thought of as an array. You need to create a new dictionary and then add it to social profiles.

@heardrwt heardrwt closed this as completed May 8, 2013
@haemi
Copy link
Author

haemi commented May 21, 2013

you're sure this should work? If I add a value like this

        [socialProfilesMutable addValue:@"myValue" withLabel:@"myLabel"];

I only have the label stored in my contact, not the value...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants