Unified Contacts

06 February, 2014

Problem of declaring CF Object as property in NS Object

Error message when analyze: incorrect decrement of the reference count of an object that is not owned

If the CF Object is declared as a property in a NS Object, the compiler is not able to determine whether the property is still being referencing by other method. In my case, I declared ABAddressBookRef as a property in a NS Object.

@interface AddressBookManager : NSObject

@property ABAddressBookRef addressBook;

The problem has been solved by changing property to instance variable

@interface AddressBookManager : NSObject {
    ABAddressBookRef addressBook;
}