Core Data Spotlight importers no longer working in Mavericks

Originator:robotspacer
Number:rdar://15379379 Date Originated:03-Nov-2013 05:02 PM
Status:Open Resolved:
Product:Mac OS X Product Version:10.9 (13A603)
Classification:Serious Bug Reproducible:Always
 
Summary:
Following the guide here: https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/SpotlightCoreData/Articles/recordLevel.html results in a Spotlight importer that no longer works in Mavericks. The following errors come up in Console:

11/3/13 12:44:10.533 PM mdworker[925]: SpotlightImporter:managedObjectModel unable to load model at URL file:///Users/mike/Library/Containers/com.junecloud.mac.Notefile/Data/Library/Caches/Metadata/CoreData/Notefile/.support/model.mom
11/3/13 12:44:10.542 PM sandboxd[327]: ([925]) mdworker(925) deny file-read-xattr /Users/mike/Library/Containers/com.junecloud.mac.Notefile/Data/Library/Caches/Metadata/CoreData/Notefile/.support/model.mom (import fstype:hfs fsflag:480D000 flags:240000005F diag:0 isXCode:0 uti:com.junecloud.notefile plugin:/Notefile.app/Contents/Library/Spotlight/Notefile Importer.mdimporter - find suspect file using: sudo mdutil -t 481665)
11/3/13 12:44:10.554 PM sandboxd[327]: ([925]) mdworker(925) deny file-read-data /Users/mike/Library/Containers/com.junecloud.mac.Notefile/Data/Library/Caches/Metadata/CoreData/Notefile/.support/model.mom (import fstype:hfs fsflag:480D000 flags:240000005F diag:0 isXCode:0 uti:com.junecloud.notefile plugin:/Notefile.app/Contents/Library/Spotlight/Notefile Importer.mdimporter - find suspect file using: sudo mdutil -t 481665)

It's hard for me to tell if this is a bug in Mavericks, or a lack of documentation on exactly how to make this work now. See here for more discussion on the issue: https://devforums.apple.com/message/914601

Steps to Reproduce:
1. Create a new Cocoa Application. (See attachment for an app that does steps 1-7!)
2. Make sure the "Use Core Data" and "Include Spotlight Importer" boxes are checked when creating the project.
3. Update the project to use NSSQLiteStoreType.
4. Set various NSExternalRecords… options for the persistent store.
5. Add a little bit of code to create some objects that are indexed by Spotlight.
6. Add a Copy Files build phase to put the importer in Contents/Library/Spotlight
7. Enable sandboxing and code signing.
8. Archive the app, export it as an application, and move it to /Applications/
9. Open the app
10. Allow the files to be indexed and monitor console for errors. (Note that manually running mdimport from Terminal WILL work successfully—to trigger the bug you need to let the files get indexed normally.)

Expected Results:
The files should get indexed successfully, and be searchable with Spotlight. Using the sample app, a search for "elephant" should reveal one of the files.

Actual Results:
Spotlight generates a bunch of sandboxing errors and the Spotlight plug-in does not work.

Notes:
A sample app that follows steps 1-7 is attached. Again, I have no idea if this is a bug or if Mavericks simply has new requirements that are not well documented.

Comments

Related Apple Developer Forums thread

https://devforums.apple.com/message/919079#919079

By robotspacer at Nov. 17, 2013, 4:36 a.m. (reply...)

Duplicate

This was marked as a duplicate of rdar://15365711

By robotspacer at Nov. 8, 2013, 4:20 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!