0
ABMutableMultiValueRef *address = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressProperty);
for (CFIndex i=0; i < ABMultiValueGetCount(address); i++) {
    CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(address, i);

The code works but generates a warning. Any clue?

Warning: FirstViewController.m:46: warning: initialization from incompatible pointer type

Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177

2 Answers2

1

I believe you're getting a warning because you're assigning an NSString* value to a ABMutableMultiValueRef* variable. You should only assign a pointer variable to a pointer of the same type.

Andy White
  • 86,444
  • 48
  • 176
  • 211
  • how do I fix it? You see that I'm using it to pull data from the multivalue – Cocoa Dev Apr 10 '11 at 20:22
  • I know that but how do I fix it? any suggestions? Xcode tells me that they aren't the same pointer – Cocoa Dev Apr 12 '11 at 13:32
  • Unfortunately, I'm not sure exactly how to fix it. ABRecordCopyValue returns a CFTypeRef, which is a generic pointer type. Mark's answer below is probably the path you need to go - you probably need to cast the rest as some CF* type. Maybe it's not CFString, but it's probably something else that starts with CF. – Andy White Apr 12 '11 at 14:15
0

ABMutableMultiValueRef is a CFTypeRef, so perhaps casting the result of ABRecordCopyValue to CFString instead of NSString would be the simple solution.

Mark Granoff
  • 16,878
  • 2
  • 59
  • 61