I don’t know if the Sane main issue writer is just really old (well, it is… 2001 or so, which is old, in software terms, I suppose), but this little Cocoa app that drives Sane Magazine each week (umm… except for the last two, since we’ve been on… hiatus/vacation), needed a little upgrade recently. But moving it to Leopard the other day I noticed that it still used Find By Content’s FBCSummarizeCFString() function… which was new as of 10.2 and deprecated as of 10.4 (doh). This was for the handy dandy summary of the latest issue we produce. A little known, little used feature, but there it is. At any rate, to get our summarization up to speed, it just took a little digging and a tiny little bit of work.
So I figured I’d write about the quick and easy fix, since it took me a few minutes of digging to find the replacement function to use: you need to look into Search Kit.
A combo of SKSummaryCreateWithString to get an SKSummaryRef and SKSummaryCopySentenceSummaryString on that with the number of sentences you want to limit it to gets you back to where we were with FBCSummarizeCFString.
CFStringRef myTextString = CFStringCreateCopy(NULL, (CFStringRef)[[self mainText] string]);
CFStringRef mySummaryString;
UInt32 numOfSentences = 2;
SKSummaryRef summaryRef = SKSummaryCreateWithString(myTextString);
mySummaryString = SKSummaryCopySentenceSummaryString(summaryRef, numOfSentences);
Enjoy.