ABMultiValueCopyValueAtIndex gives message sent to deallocated instance.

Posted by Mohammed Sadiq on Stack Overflow See other posts from Stack Overflow or by Mohammed Sadiq
Published on 2010-03-13T07:32:33Z Indexed on 2010/03/13 7:35 UTC
Read the original article Hit count: 546

Filed under:

HI ,

I am getting a issue when trying to access the kABPersonInstantMessageProperty. The code is as follows :

    ABMultiValueRef IMS = ABRecordCopyValue(record, kABPersonInstantMessageProperty);
CFRetain(IMS);
if(IMS)
{
    int IMSCount = ABMultiValueGetCount(IMS);
    MWLOG(5, @"**** IMS COunt **** : %d", IMSCount);
    for(int iIM =0; iIM < IMSCount; ++iIM)
    {
        MWLOG(5, @"index *** : %d", iIM);
        CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(IMS, iIM);
        NSString* label = (NSString*)ABMultiValueCopyLabelAtIndex(IMS, iIM);

        NSString* service= (NSString*)CFDictionaryGetValue(dict, kABPersonInstantMessageServiceKey);
        NSString* username= (NSString*)CFDictionaryGetValue(dict, kABPersonInstantMessageUsernameKey);

        if(label) CFRelease(label);
        if(service) CFRelease(service);
        if(username) CFRelease(username);
        if(dict) CFRelease(dict);
    }

    CFRelease(IMS);
}

But I am getting the following error in console :

2010-03-13 12:39:16.731 mwp[1464:4f0b] * -[CFString retain]: message sent to deallocated instance 0x1582820

2010-03-13 12:49:12.219 mwp[1464:4f0b] * -[CFString _cfTypeID]: message sent to deallocated instance 0x15f0bf0

The stacktrace in the debugger is as follows :

**#0 0x3026e017 in forwarding

#1 0x3024a0a2 in __forwarding_prep_0___

*#2 0x30201368 in CFRetain *

#3 0x325bdb6d in ABCCopyDictionaryWithTypes

#4 0x325bdbe3 in ABCMultiDictionaryCreateCopy

  • Is that the issue is with the api. I searched in the net but could nt find any solutions.

I am getting this issue only in reading the InstantMessageProperty.

Any help would be greatly appreciated ....

Best Regards,

Mohammed Sadiq.

© Stack Overflow or respective owner

Related posts about iphone