Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Giacomo Tufano
I'm trying to create a spotlight importer for a core data application, using 
the record level indexing as descripted in the Core Data Spotlight 
Integration Programming Guide.

I have a working .mdimporter that works correctly if I copy the importer in 
/Library/Spotlight (it will index and spotlight find the documents). 
The problem is that the embedded importer in the application (I started with 
the Xcode template for use core data and create importer is never called by 
the system. I checked that the .mdimporter is in the app bundle inside the 
Contents/Resources/APPNAMEImported.mdimporter directory.
I'm planning to use MAS, so I *think* I cannot move anything in 
/Library/Spotlight.

I religiously read the guide many times (and especially the troubleshooting 
section) but, you know, the more you read, the same it seems. :) Any hint on 
what to look for will be appreciated, I'm out of ideas.

I strongly suspect that the problem is related to the sandboxing of the app, 
because the Guide seems to not consider sandbox. For example, I had to find by 
trial and error that the the NSExternalRecordsDirectoryOption for the 
persistent store is a tricky one for sandboxed app, at the end I use 
NSLibraryDirectory/CoreData/LocalConfig/ but the runtime raised exception for 
almost any other one, included the recommended (by the exception in itself) 
~/Library/Caches/Metadata/CoreData (sandbox error) or 
NSCacheDirectory/Metadata/CoreData (error 'should be 
~/Library/Caches/Metadata/CoreData').

If some code is needed to troubleshoot, just ask (I really have no idea of what 
could be useful and not simply noise).

Thank you in advance,
gt


___

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


Re: Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Vincent CARLIER
Date: Tue, 14 May 2013 12:07:02 +0200
 From: Giacomo Tufano g...@iltofa.com
 To: cocoa-dev@lists.apple.com
 Subject: Sandboxed app  record-level indexing of Core Data in
 Spotlight (not  working)
 Message-ID: 127dc0cb-c922-435c-adba-e873e8593...@iltofa.com
 Content-Type: text/plain; charset=us-ascii

 I'm trying to create a spotlight importer for a core data application,
 using the record level indexing as descripted in the Core Data Spotlight
 Integration Programming Guide.

 I have a working .mdimporter that works correctly if I copy the importer
 in /Library/Spotlight (it will index and spotlight find the documents).
 The problem is that the embedded importer in the application (I started
 with the Xcode template for use core data and create importer is never
 called by the system. I checked that the .mdimporter is in the app bundle
 inside the Contents/Resources/APPNAMEImported.mdimporter directory.
 I'm planning to use MAS, so I *think* I cannot move anything in
 /Library/Spotlight.

 I religiously read the guide many times (and especially the
 troubleshooting section) but, you know, the more you read, the same it
 seems. :) Any hint on what to look for will be appreciated, I'm out of
 ideas.

 I strongly suspect that the problem is related to the sandboxing of the
 app, because the Guide seems to not consider sandbox. For example, I had to
 find by trial and error that the the NSExternalRecordsDirectoryOption for
 the persistent store is a tricky one for sandboxed app, at the end I use
 NSLibraryDirectory/CoreData/LocalConfig/ but the runtime raised exception
 for almost any other one, included the recommended (by the exception in
 itself) ~/Library/Caches/Metadata/CoreData (sandbox error) or
 NSCacheDirectory/Metadata/CoreData (error 'should be
 ~/Library/Caches/Metadata/CoreData').

 If some code is needed to troubleshoot, just ask (I really have no idea of
 what could be useful and not simply noise).

 Thank you in advance,
 gt


Hi gt,

If your importer is bundled into your app, it should be in :

Appname.app/Contents/Library/Spotlight

Vince.
___

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


Re: Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Giacomo Tufano
Il giorno 14/mag/2013, alle ore 13:00, Vincent CARLIER 
vince.carl...@gmail.com ha scritto:

 I have a working .mdimporter that works correctly if I copy the importer in 
 /Library/Spotlight (it will index and spotlight find the documents).
 The problem is that the embedded importer in the application (I started 
 with the Xcode template for use core data and create importer is never 
 called by the system. I checked that the .mdimporter is in the app bundle 
 inside the Contents/Resources/APPNAMEImported.mdimporter directory.
 I'm planning to use MAS, so I *think* I cannot move anything in 
 /Library/Spotlight.
 
 If your importer is bundled into your app, it should be in :
 Appname.app/Contents/Library/Spotlight

Thank you Vincent! In Contents/Library/Spotlight works. I'm wondering where's 
documented, but it's OK (my fault, probably).

I now get errors (one for every file) in mdworker (apparently from sandboxing) 
stating:
14/05/13 13:24:43,007 sandboxd[29551]: ([29550]) mdworker(29550) deny 
file-write-create 
/Users/gt/Library/Containers/it.iltofa.Janus/Data/Documents/SharedCoreDataStores/.localStore_SUPPORT/.LINKS
 (import fstype:hfs fsflag:480D000 flags:24005F diag:0 uti:it.iltofa.janus 
plugin:/Janus.app/Contents/Library/Spotlight/JanusImporter.mdimporter - find 
suspect file using: sudo mdutil -t 17981324)
but it seems to work (records are indexed spotlight find them, etc. (now I'll 
try to understand what else is wrong).

Beside that, I'll have to understand how to convince Xcode to copy the 
.mdimporter in Library/Spotlight automatically (but this seems easier).

Thank you *very* much,
gt

btw: a test project just created with Xcode 4.6.2 cocoa app template 
generates an .mdimporter bundled under Resources. Should I file a bug or this 
is expected?

___

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


Re: Sandboxed app record-level indexing of Core Data in Spotlight (not working)

2013-05-14 Thread Vincent CARLIER
Re gt,

2013/5/14 Giacomo Tufano g...@iltofa.com

 Il giorno 14/mag/2013, alle ore 13:00, Vincent CARLIER 
 vince.carl...@gmail.com ha scritto:

 I have a working .mdimporter that works correctly if I copy the importer
 in /Library/Spotlight (it will index and spotlight find the documents).
 The problem is that the embedded importer in the application (I started
 with the Xcode template for use core data and create importer is never
 called by the system. I checked that the .mdimporter is in the app bundle
 inside the Contents/Resources/APPNAMEImported.mdimporter directory.
 I'm planning to use MAS, so I *think* I cannot move anything in
 /Library/Spotlight.


 If your importer is bundled into your app, it should be in :
 Appname.app/Contents/Library/Spotlight


 Thank you Vincent! In Contents/Library/Spotlight works. I'm wondering
 where's documented, but it's OK (my fault, probably).


It's documented in the section Troubleshooting Spotlight Importers, in
Spotlight Importer Programming Guide :

An application’s Spotlight importer resides within the application’s
bundle in the subdirectory MyApp.app/Contents/Library/Spotlight. (top of
the page).


 I now get errors (one for every file) in mdworker (apparently from
 sandboxing) stating:
 14/05/13 13:24:43,007 sandboxd[29551]: ([29550]) mdworker(29550) deny
 file-write-create 
 /Users/gt/Library/Containers/it.iltofa.Janus/Data/Documents/SharedCoreDataStores/.localStore_SUPPORT/.LINKS
 (import fstype:hfs fsflag:480D000 flags:24005F diag:0
 uti:it.iltofa.janus
 plugin:/Janus.app/Contents/Library/Spotlight/JanusImporter.mdimporter -
 find suspect file using: sudo mdutil -t 17981324)
 but it seems to work (records are indexed spotlight find them, etc. (now
 I'll try to understand what else is wrong).


Sounds like a permission problem, I never had such a problem though.


 Beside that, I'll have to understand how to convince Xcode to copy the
 .mdimporter in Library/Spotlight automatically (but this seems easier).


Add a copy files phase in the Build Phases for the app target, select the
Wrapper item in the popup button and add the subpath to the directory in
the field below.


 Thank you *very* much,
 gt

 btw: a test project just created with Xcode 4.6.2 cocoa app template
 generates an .mdimporter bundled under Resources. Should I file a bug or
 this is expected?


Not sure it is expected, as the documentation tells to put the importer in
another directory. I imagine Xcode defaults to the Resources directory when
it has to copy things.

Vince.
___

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