0

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

Community
  • 1
  • 1
QueueOverFlow
  • 1,336
  • 5
  • 27
  • 48

1 Answers1

1

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579