[Interest] Qt 5 and Mac App Store

Till Oliver Knoll till.oliver.knoll at gmail.com
Fri Oct 19 11:54:50 CEST 2012


2012/10/19 Daniel Price <daniel.price at fxhome.com>:
> What's the solution to the file-link issue in Qt? Sandboxing prevents an app from reading or writing to any file other than those chosen specifically by a user via powerbox (the native dialogs). So if you app has a 'recent file' list or some other way to access files programmatically, it won't work.

The magic keyword here is: Security Scoped URLs

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html

"In an OS X app that adopts App Sandbox, to gain persistent access to
a file-system resource you must use a security-scoped bookmark. Such a
bookmark preserves, across app launches, a user’s intent to give your
app access to a resource. For details on how this works, including
information on the entitlements you need in your Xcode project, read
“Security-Scoped Bookmarks and Persistent Resource Access” in App
Sandbox Design Guide."

So each time the user opens a file via file dialog and you want to add
it to the "Recent Files" menu, you also request that the given (file)
URL be "security scoped", with the corresponding native Apple APIs. I
am not familiar with that API yet, but shouldn't be a big deal.


As of Qt 4.8.x Qt itself doesn't provide a QRecentFile (or similar)
class/functionality, so if you want to implement such a functionality
yourself (which is easy) you should also make calls to the underlying
"native" API (linking Objective-C++ *.mm files with your existing
C++/Qt files works like a charm - qmake provides the necessary
infrastructure, too!).


So does Qt 5 provide a "Recent Files" class? If so, it would off
course be nice if "security scoped URLs" were part of that game. If
not, then it's a "non-Qt issue".


Thanks for wrapping up the "Qt App Store state" - and off course
making it possible bringing Qt applications into the App Store :)

Cheers, Oliver



More information about the Interest mailing list