문제

I am a newbie and I have a question with ABRecordSetValue in Xcode 4.2. I have this code:

        ABRecordSetValue(aContact, kABPersonLastNameProperty, lastName, &anError);    

But, I keep on receiving this error message:

Implicit conversion of an Objective-C pointer to 'CFTypeRef' (aka 'const void *') is disallowed with ARC

I have the 'lastName' field as a NSString. What is wrong with my code?

Thank you in advance.

도움이 되었습니까?

해결책

As third parameter expects CFTypeRef, we can do below casting.

Try this:

ABRecordSetValue(aContact, kABPersonLastNameProperty, (CFStringRef)lastName, &anError);

다른 팁

I was having a similar error (iOS 5.0) I needed to add __bridge

ABRecordSetValue(aContact, kABPersonLastNameProperty, __bridge CFStringRef)lastName);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top