Re: SKIndexAddDocument crashing
Re: SKIndexAddDocument crashing
- Subject: Re: SKIndexAddDocument crashing
- From: Mike Abdullah <email@hidden>
- Date: Wed, 06 Nov 2013 12:29:59 +0000
On 6 Nov 2013, at 02:18, Eric Gorr <email@hidden> wrote:
> 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.
First rule of crashes: include the stack trace for us, please.
_______________________________________________
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