QueueOverFlow
QueueOverFlow

Reputation: 1336

implicit conversion of objective-c pointer type nsstring to cpointer type 'CFTypeRef'

I am using this link for storing contact info, in my opinion there is little bit problem with ARC.

when I use this below code it's work fine.

ABAddressBookRef libroDirec = ABAddressBookCreate();

ABRecordRef persona = ABPersonCreate();

ABRecordSetValue(persona, kABPersonFirstNameProperty, @"JustTESTING", nil);

on other hand when i use this below code its gives error implicit conversion of objective-c pointer type nsstring to cpointer type 'CFTypeRef'

NSString * prefName = ref.fName; 

ABAddressBookRef libroDirec = ABAddressBookCreate();

ABRecordRef persona = ABPersonCreate();

ABRecordSetValue(persona, kABPersonFirstNameProperty, prefName, nil);// error in prefName

Thanks

Upvotes: 0

Views: 3407

Answers (1)

rmaddy
rmaddy

Reputation: 318824

You need to add a cast to make ARC happy:

ABRecordSetValue(persona, kABPersonFirstNameProperty, (__bridge CFTypeRef)prefName, nil);

prefName is an NSString * and the 3rd parameter needs a CFTypeRef.

Upvotes: 1

Related Questions