0

I want to search an array of NSDate, so here what I do:

searchResult = CFArrayBSearchValues((CFArrayRef)someDateArray, arrayRange, dateToFind, CFDateCompare, nil); 

However, I get this warning:

Incompatible pointer types passing 'CFComparisonResult (CFDateRef, CFDateRef, void )' to parameter of type 'CFComparatorFunction' (aka 'CFComparisonResult ()(const void *, const void *, void *)')

How do I properly pass a function as a parameter? I think I got my syntax wrong.

1 Answer 1

3

You need to cast the function pointer to the CFComparatorFunction type, since it has a more explicit signature (it uses CFDateRef instead of void *).

searchResult = CFArrayBSearchValues((CFArrayRef)someDateArray, arrayRange, dateToFind, (CFComparatorFunction)CFDateCompare, nil); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.