Bundled content in an app store app - macos

I am trying to get my app submitted to the mac app store and I am having a bit of a design problem. Our app is an authoring tool and comes bundled with many projects created with the tool. Before the time of the app store, we would ship our app as an .img file which contianed a project directory and our app. Since I am only going to be submitting the .app file to the app store
with my app I am wondering where I should but the projects directory.
Initially I tried to put the projects directory inside of the bundle but this will not work because it is possible for the user to make changes to projects which might add new files to the project directory and this would make the sandboxing unhappy and mark the app as invalid.
What is the correct place to store such resources? I assume they should go inside the container? If so, what would be an elagent way to deploy this projects directory? Since we do not have installers in Apple land what would be the best place to deploy this projects directory? Do I just need to check on app launch if the projects are present and if not copy them from the bundle? This seems wrong.

Do I just need to check on app launch of the projects are present and if not copy them from the bundle?
Actually, this sounds right to me. As you said, the user cannot change/add any files in the app bundle. If you have resources there that the user needs to interact with, I would copy them to the ~/Library/Application Support/MyApp/ folder when they are needed. The user can then interact with the files from that location. (When sandboxed they go into a different but related location.)
I don't really know what your app does, but it would also seem like a possibly useful feature to "reset" the project files/folders back to a starting state. So copying the files in this way would allow for that kind of behavior as well.

Related

Best Practice User Files and Folders in AppData

I’m writing an application that should save user specific data into AppData. This application has an installer. Now I’m not sure, what is the best way to provide the folders in AppData.
Should the installer create (and delete) the folders, or should the application itself create (but probably never delete) the folders.
Also, if multiple user on the same computer use the app, the folders probably doesn’t exist, if another user installed the application.
I didn’t found anything that really explained this to me.
Thanks in advance.
I'll answer for Windows Installer, MSI files, and basically you shouldn't need to worry about it in the installer; just install files to their required locations, and the folder will be created automatically and removed at uninstall if it's empty.
In addition to Phil's correct answer:
If the files from the AppData folders used by your application are created only by the application, at run time, there is no need to configure the installer to create the empty folders. Those folders will be created the moment your app writes down the files.
Also, even if your installer is creating the folder, on uninstall it will not remove if in that folder are files created by the application. Windows Installer keeps track (should do it in a correctly configured package) of every file it installs and only removes the ones it installed (by default, it can be configured to force remove a folder and files which it did not install).
Regarding other users of the app. In this scenario, the simplest method is to use your application for creating the initial default files in the AppData folder, at the first launch of the app for each user.
If you need to install files to AppData from your installer then you could try one of the following approaches. These techniques can be applied with any setup authoring tool that can create MSI packages.

How can I include an Apple Help Book when building my app for OSX

I have developed a Firemonkey app for Windows and OSX. I have also developed an Apple Help Book containing the help for my application when it is run on OSX. (I have a different help system when running in Windows.) Apple's recommended location for the help bundle is in the app's Contents/Resources folder. I can copy the help bundle there manually but it gets deleted every time I run my app in the IDE or deploy my app.
I thought about trying to use the deployment manager but this only allows files to be deployed, not bundles. The help bundle contains a large number of files spread amongst various folders and it would be tedious to set each file up individually in the deployment manager. Moreover, I would have to change the setup every time I added or deleted a page from help since each page is a separate HTML file in the bundle.
So for now, I am manually pasting the help bundle into Contents/Resources. Does anyone know of a more efficient method to incorporate the help bundle?
After much research, I came to the conclusion that the only reasonable way to incorporate an Apple helpbook is to paste its bundle into the app bundle at the location Contents/Resources. I thought about locating it elsewhere but Contents/Resources is where Apple recommends it should go. This is inconvenient because it gets erased whenever I redeploy the app or run it from the IDE. But until Firemonkey is enhanced to make provision for helpbooks, this seems to be the only acceptable way to do it. The program 'Packages' http://s.sudre.free.fr/Software/Packages/about.html is then a great way to package the app for issue to customers.

How can I add a file to an existing Mac OS X .app bundle?

I'm writing a modification for Arduino that turns an Arduino board into a game controller.
In order to add my board-specific files to the programming environment, right now, the user needs to open up the Arduino.app package, and then add a few different files into a various folders in the Arduino.app package. It is hardly user friendly. How can I make an installer which automatically moves my files into the appropriate locations within Arduino.app, or is that impossible?
You can download PackageMaker (available here, in the Auxiliary Tools for Xcode download).
You will then be able to make a .pkg that the user will be able to install simply by double clicking. You can also make a script that will check if Arduino is already installed and stop the installation if it's not. You get the idea.
Normally, especially in today's code-signed MacOS app approach (where any modifications to the app or its resources/files would break the app & make it not-launchable), I would say "you're out of luck".
But Arduino is one of the rare OPEN SOURCE apps.
You can fetch the source code from this page:
http://arduino.cc/en/Main/Software
And make your modifications to the project and then build a fresh, customized copy for yourself.
I figured out how to do it using the magic of scripting!
You can take a look at my solution here:
http://code.google.com/p/unojoy/source/browse/#hg%2FLeoJoy%2FLeoJoy%20Installer.app%2FContents%2FMacOS
The folder structure it's in makes it show up as an app on OSX, and the two scripts (LeoJoy Installer and LeoJoyInstaller.command) copy the files. There's two scripts there because I wanted to have a console window pop up to show the user progress, and that's the only way I could figure out how to do that. But, if you run this app in the same directory as the Arduino app, it copies files from the installer app into the Arduino.app package, updating the Arduino app so I don't have to distribute a whole separate version of Arduino.

Creating a folder inside Mac OS App

I want a an app that is "self-contained" (I don't know if i use the right word. "putting the app into trash bin will remove everything" is what I meant). But the app requires some resources to run. I usually put those resources into a folder. I want to move those resources into the App folder ( package contents). Can I do that? Is it a good practice to do that?
When I test the app directly running from Xcode, the App runs fine. But if i run it from finder, the app will say fails to create resources folder because permission denied. I checked the app's folder permission - User(me) has read/write access. I am wondering what is causing this different behavior.
The last option is to use Application Support folder, but I don't want to leave trails when user deletes the app.
Can someone help me out here?
Applications live in the directory /Applications, where users don't generally have write access. Requiring an app to have write permission in system folders is extremely bad practice.
Runtime files should live in ~/Library/Application Support. While that folder tends to accumulate some cruft, unless your application leaves behind really large files, that shouldn't be a problem.
If you want your application to be self-contained, it needs to come with all the files it needs from the get-go, and not write anything to disk.

Some generic and working Xcode project settings which lead to successful Mac App store submission?

I built a simple app that I'd like to submit to the Apple store, but I am not sure whether my project Release settings are set correctly. I adjust a few things, based on what I could find online, but I might've created more problems than I solved.
I would very much appreciate if somebody could provide a copy of working Release settings which would sure work for my project. I don't store/read any files, the application just runs a few commands. Basically, I just need it to run and install in that /Applications folder so the user could trigger a launch.
Basically use default settings, move your source code to a new project, read up the guidelines and see if anything is told to change, otherwise it's just fine. Cheers.

Resources