• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
SKIndexAddDocument crashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: SKIndexAddDocument crashing
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Mutually exclusive item filtering-comparing
  • Next by Date: Re: MDItemCopyAttributes replacement for audio
  • Previous by thread: Re: URLByResolvingBookmarkData: crashes on 10.8
  • Next by thread: Re: SKIndexAddDocument crashing
  • Index(es):
    • Date
    • Thread