0

I'm importing contacts from iPhone contacts in my class and then I made the extension of my file to a c++ (because I need to use a library that requires it to be .mm) and then an error occurred.

code: CFStringRef phoneNumberRef = ABMultiValueCopyValueAtIndex(phones, j);

error: cannot initialize a variable of type 'CFStringRef' (aka'const__CFString*') with an rvalue of type CFTypeRef (aka 'const void *')

I'm pretty much lost.

Jongers
  • 595
  • 1
  • 9
  • 29

1 Answers1

0

I randomly put (CFStringRef) after the = sign and it fixed the error. It seems that c++ compiler doesn't want automatic casting.

This did the trick:

CFStringRef phoneNumberRef = (CFStringRef) ABMultiValueCopyValueAtIndex(phones, j);
Jongers
  • 595
  • 1
  • 9
  • 29