开发者

Why is this generating a warning?

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

The code works but ge开发者_StackOverflownerates a warning. Any clue?

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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜