Spotlight importer don't work anymore under Mavericks (sandbox error)
Spotlight importer don't work anymore under Mavericks (sandbox error)
- Subject: Spotlight importer don't work anymore under Mavericks (sandbox error)
- From: Giacomo Tufano <email@hidden>
- Date: Thu, 24 Oct 2013 23:12:58 +0200
Hi, I have a spotlight importer for a sandboxed coredata application, derived directly from the Xcode 4.x template and working embedded in the app.
The importer works under OS X 10.7 and 10.8 but fails in allocating the NSManagedModel from the storeURL located in the sandbox at containerdir/Data/Library/CoreData/LocalConfig/.support/model.mom
In console I see a related sandbox error at the same time of my error:
24/10/13 19:31:49,364 sandboxd[351]: ([2437]) mdworker(2437) deny file-read-xattr /Users/gt/Library/Containers/it.iltofa.Janus/Data/Library/CoreData/LocalConfig/.support/model.mom (import fstype:hfs fsflag:480D000 flags:240000005F diag:0 isXCode:0 uti:it.iltofa.janus plugin:/Janus Notes.app/Contents/Library/Spotlight/Janus NotesImporter.mdimporter - find suspect file using: sudo mdutil -t 22334033)
The store is allocated in the “main” app with:
NSURL *cacheDirectory = [[NSFileManager defaultManager] URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&localError];
cacheDirectory = [cacheDirectory URLByAppendingPathComponent:@"CoreData/LocalConfig/" isDirectory:YES];
if(![[NSFileManager defaultManager] createDirectoryAtURL:cacheDirectory withIntermediateDirectories:YES attributes:nil error:&localError]) {
ALog(@"Error creating %@: %@", cacheDirectory, [localError description]);
assert(NO);
}
NSString *externalRecordsSupportFolder = [cacheDirectory path];
NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption: @YES,
NSExternalRecordExtensionOption: @"janus",
NSExternalRecordsDirectoryOption: externalRecordsSupportFolder,
NSExternalRecordsFileFormatOption: NSXMLExternalRecordType
};
_localStore = [_psc addPersistentStoreWithType:NSSQLiteStoreType configuration:@“LocalConfig” URL:storeURL options:options error:&localError];
The failing call on the importer is:
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:self.modelURL];
where self.modelURL is inited as:
NSDictionary *pathInfo = [NSPersistentStoreCoordinator elementsDerivedFromExternalRecordURL:[NSURL fileURLWithPath:filePath]];
self.modelURL = [NSURL fileURLWithPath:[pathInfo valueForKey:NSModelPathKey]];
IIRC this is the template code.
I suspected a signing error, but the importer built with XCode 4 was not signed at all, and it is signed on Xcode 5 with the same identity as the main app.
The importer embedded in the app freshly downloaded from the App Store works as intended under ML with no error at all and fails under Mavericks with the error above.
I was not able to find anything on the Internet and I’m out of ideas… It seems strange to me that this is a bug because I think this is a very common case (at least, I think that a core data app with a spotlight importer is not *so* strange)
any hint/suggestion will be appreciated… more code is available on request, in case it will be useful.
Thank you in advance,
gt
_______________________________________________
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