|Real Software Forums
|Security Scoped Bookmarks are unreliable.
|Page 1 of 1|
|Author:||rowlands [ Mon May 06, 2013 12:02 am ]|
|Post subject:||Security Scoped Bookmarks are unreliable.|
I'm just writing a post here to warn people that we've discovered that Security Scoped Bookmarks are unreliable and are causing us and our customers headaches.
The most common problem we face is the access timing out before we've finished with the file and also access randomly being denied to files. It seems that if you have a file you need to access frequently, SSBs are _not_ the way to do it.
Using a SSB for a file to be used by Core Image, will cause issues. Core Image is a lazy processor which means it only loads data from the file when it actually renders the image. So you need to gain access when you create the core image object (otherwise it fails) and then you need to regain access when you render (and in some cases regaining access can fail at either point), thus destroying your app.
I would expect that it may have the same behavior for a database application also.
It could of course be my code that I've written for accessing SSBs, but there are other ways to do it and I'm researching them.
For instance so far my tests on using Apple Recent document system, automatically retains access to that file. Before I release the code, I want to do more testing and confirm this with a real shipping application (as that's where I found failures was in a real shipping application, not a demo app).
The other thing I'm investigating is using NSDocument to retain access, according to Apple's docs, access is retained on open NSDocuments when the application quits.
If the above methods work, it also means that RS apps will be able to retain/restore access to previous files on Mac OS X 10.7~7.2 as well.
Some other issues we've encountered with SSBs include retaining a reference to a file within your resources folder will get your app rejected by Apple.
Using SSBs to maintain a Recent Items list, updates the modified date on _all_ recent items when the SSB is created.
If anyone else has found a better solution, I would love to hear from them.
|Page 1 of 1||All times are UTC - 5 hours|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group