SKIndexAddDocument crashing
SKIndexAddDocument crashing
- Subject: SKIndexAddDocument crashing
- From: Eric Gorr <email@hidden>
- Date: Tue, 05 Nov 2013 21:18:24 -0500
I've got a functioning sample project at https://github.com/ericgorr/searchtest.git
The relevant code is self contained in the applicationDidFinishLaunching method in ELIZAppDelegate.m...
NSBundle* mainBundle = [NSBundle mainBundle];
NSURL* docURL = [mainBundle URLForResource:@"message" withExtension:@"emlx"];
NSString* homePath = NSHomeDirectory();
NSURL* homeURL = [NSURL fileURLWithPath:homePath];
NSString* searchIndexName = @"index.idx";
NSURL* indexURL = [homeURL URLByAppendingPathComponent:searchIndexName];
SKIndexRef searchIndexFile;
SKLoadDefaultExtractorPlugIns();
NSDictionary* textAnalysisOptions = @{ (__bridge NSString*)kSKProximityIndexing : @YES };
[[NSFileManager defaultManager] removeItemAtURL:indexURL error:nil];
searchIndexFile = SKIndexCreateWithURL( (__bridge CFURLRef)indexURL,
(__bridge CFStringRef)searchIndexName,
kSKIndexInverted,
(__bridge CFDictionaryRef)textAnalysisOptions );
NSLog( @"Index Exists: %d", [[NSFileManager defaultManager] fileExistsAtPath:[indexURL path]] );
NSLog( @"Message Exists: %d", [[NSFileManager defaultManager] fileExistsAtPath:[docURL path]] );
CFURLRef fullMessageURLRef = (CFURLRef)CFBridgingRetain( docURL );
SKDocumentRef doc = SKDocumentCreateWithURL ( fullMessageURLRef );
SKIndexAddDocument( searchIndexFile, doc, NULL, false );
NSLog( @"added" );
Everything works up to the point where SKIndexAddDocument is called and then it crashes and I am not sure why...
Built with Xcode Version 5.0.1 (5A2053) and running OS X 10.9.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden