On 6 Nov 2013, at 02:18, Eric Gorr <mail...@ericgorr.net> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to