On Nov 6, 2013, at 7:29 AM, Mike Abdullah <mabdul...@karelia.com> wrote:
> > 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. The stack trace won't be particularly helpful in this case... Thread 1, Queue : com.apple.main-thread #0 0x0000000105f24b95 in LoadMailMDImporterPlugin () #1 0x0000000105f24cee in AllocMetadataImporterPluginType () #2 0x0000000105f2514a in MetadataImporterPluginFactory () #3 0x00007fff8b9ecd80 in _CFPFactoryCreateInstance () #4 0x00007fff8a676203 in ResolveInterfaceForUTIType () #5 0x00007fff8a676402 in ImportContentsFromURL () #6 0x00007fff8a6699f4 in SKIndexAddDocument () #7 0x0000000100001363 in -[ELIZAppDelegate applicationDidFinishLaunching:] at /Users/ericgorr/depot/search test/search test/ELIZAppDelegate.m:43 #8 0x00007fff8b9e5fcc in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ () #9 0x00007fff8b8d9c5d in _CFXNotificationPost () #10 0x00007fff8cda44aa in -[NSNotificationCenter postNotificationName:object:userInfo:] () #11 0x00007fff89449b79 in -[NSApplication _postDidFinishNotification] () #12 0x00007fff894498ac in -[NSApplication _sendFinishLaunchingNotification] () #13 0x00007fff89446796 in -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] () #14 0x00007fff894461eb in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] () #15 0x00007fff8cdc2eaa in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] () #16 0x00007fff8cdc2d1d in _NSAppleEventManagerGenericHandler () #17 0x00007fff84c65e1f in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) () #18 0x00007fff84c65c32 in dispatchEventAndSendReply(AEDesc const*, AEDesc*) () #19 0x00007fff84c65b36 in aeProcessAppleEvent () #20 0x00007fff8a13f5f1 in AEProcessAppleEvent () #21 0x00007fff894420f6 in _DPSNextEvent () #22 0x00007fff894418db in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #23 0x00007fff894359cc in -[NSApplication run] () #24 0x00007fff89420803 in NSApplicationMain () #25 0x00000001000014d2 in main at /Users/ericgorr/depot/search test/search test/main.m:13 #26 0x00007fff8845d5fd in start () #27 0x00007fff8845d5fd in start () If I hand SKIndexAddDocument a text file, the code works without issue. As best I can figure, there is a problem with OS X's emlx spotlight importer in Mavericks. In any case, I have filed a bug report as well... rdar://15410920 _______________________________________________ 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