Hi, for the records (and future searchers):

As per https://developer.apple.com/library/mac/qa/qa1773/_index.html (I should 
have read this one before) the importer have to be signed with the same 
identity and entitled for com.apple.security.app-sandbox.
To check if the importer works you *must* move it in the /Applications folder 
(ie: executing the main app in the debugger is not enough).

The main issue is that under Mavericks embedded spotlight importers not signed 
don’t work anymore (correctly, in a way).

Il giorno 24/ott/2013, alle ore 23:12, Giacomo Tufano <g...@iltofa.com> ha 
scritto:

> 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.


_______________________________________________

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