I have a sandboxed osx app which contains a huge number of logos as png-files.
If there are any logos missing, the app downloads the missing logos automitcally from the web.
Because the app is sandboxed, all logos are stored in a folder in Library > Applikation Support
.
My question is now, how I could distribute the already existing logos with an app bundle?
The best way would be, if the app launches the first time, the logo-folder inside Application Support gets created and all Logos are copied from the bundle inside the new folder.
Is this possible with an app bundle or do I have to create an installer? Any help would be much appreciated.
Let's see if we can round out the comments you've received so far.
My question is now, how I could distribute the already existing logos with an app bundle?
Short answer: just include them in the bundle as resources. Many applications include images for use in their GUI the only difference you have is maybe its a "huge number".
Long answer:
Here is the outline one way to do it:
Logos
, which is associated with a folder (in Xcode 9 New Group
generates the folder, prior to that you can create the folder-less Group and then use the File Inspector to add one).Resources
, say Logos
.As the images are part of your app bundle you can access them directly from there using standard bundle and file routines. There is no need to copy them anywhere.
Finally you managed to cause some confusion with the statement:
Because the app is sandboxed, all logos are stored in a folder in
Library > Applikation Support
.
It is unclear which folder you mean here, there are three obvious candidates:
/Library/Application Support
~/Library/Application Support
~/Library/Containers/<bundle id>/Data/Library/Application Support
If you are using the APIs (URLsForDirectory:inDomains:
, URLForDirectory:inDomain:appropriateForURL:create:error:
, NSSearchPathForDirectoriesInDomains
), request the user domain, and are in a sandboxed app then (3) is returned instead of (2) and your sandboxed app has access to it with asking permission from the user.
A subfolder of Application Support
(whichever one you use but (3) is recommended), typically named according to the bundle ID of your app, is the place you should store logos your app downloads – there is no need to copy images you include in your app bundle into the same location.
HTH