Moving towards Sandboxing

Have been think of making changes to my application so it will sandbox. I only have two files. A pref file, which is already in my folder in the SpecialFolder.ApplicationData; and a database file.

Do I need to put my database in there also?
Do this only for Mac or both Mac and Windows? It is currently in the document folder.

Should I just copy the file(RealSQL) or should I rebuild it as a SQLite database?

The easiest solution would be to copy the database into the application support folder, then to work on it there. Don’t try to access it while it’s in your apps resources folder, as this will be a Sandbox violation.

I would suggest using App Wrapper Mini (available on the Mac App Store), so that your app is Sandboxed while you develop it

Thanks Sam; I have App Wrapper Mini, got it yesterday. Working good. It’s a good learning tool.

Had some problems with it, WELL NOT it, XOJO - it would not stick Xojo keep dropping the code, eventho it look as if it were there … strange … Xojo will get it worked out.

Pleased to hear it, but I’m not sure I understand what the issue is, could you elaborate so I can look into it, in case it as a AWM issue or if there is something I can improve with the AWM end.

I try to remember just happened. After inserting the Build Script file I renamed it. Then ran the build, did not see anything different from previous runs. Ran the application, did not notice any change. Open the application, look at the content, did not see anything different. Did not know what I expected to be different, thought at a minimum I would see something for my Apple Certificate. NOTE: I also use MBS Updater, which also has script after the Build step; it was doing it thing so I knew that the script should be running.

Looking at Xojo I could see that the Script was still there, moved it before the build, moved it after the build before the MBS script, then after. It just look as if it was not doing anything. It wasn’t!

Then I saw the problem… The “File” entry was empty - blank - nil - nada

I think this is a reoccurring problem in Xojo… sometimes stuff just does not stick in the Inspector. The bad thing here is that the script name was still in the build step, no warning or error from Xojo.

I then deleted the script and re-inserted the script. Re-ran the Debug build and … crash … Sandbox …

Ah - I see.

Make sure that AWM is at the bottom of your scripts, if you apply the MBS updater after the app has been Sandboxed, it will break the code signature. This will mean that others won’t be able to use your app.

When you run into issues with a Sandboxed application, the first place to check is “Console”. If your app’s issue is because of Sandboxing, there will be a Sandbox violation written to the Console. Most of the time, the error messages are perfectly understandable.

Thanks Sam.

Sandboxing changes or for OSX 10.8 and later. Will the older OSX have issues with these modification? The only changes I have had to make so far has resulted in moving files to the my folder in the App Data folder. But I don’t know what I will run into later.

Older versions should have no issues. Be sure to setup a migration.plist file so users upgrading their OS won’t have their data left behind.

Sandboxing kicks in with version 1.07 or newer, although a Sandboxed app will run on older OSes (if it can).

Do you have existing users of your application? Where was your database file stored previously?

The user select a folder and name, I suggest a name and document folder. That will be a problem for migration?

I know I have some mac users using 10.6. Will I need to program for that, right?

Over 90% of the user are on windows, I’ll need to program for that also.

I plan to do the Sandboxing thing in two version updates.

First version/stage will move the DB to the users App Data folder and change name, if necessary, to the regular name.
My pref file is already in the App Data folder.

Second version/stage will do the migration thing, and sandbox.

Yes - migration only works from static locations.

However what you can try to do, is if there is no database setup, check the prefs, if you find a link, check if you can read the file. If you can’t read the file, then ask the user to select the file and then copy it into the app support folder.

[quote=31089:@James A Smith]
I know I have some mac users using 10.6. Will I need to program for that, right?[/quote]
Don’t worry about it, the app will operate unsandboxed on 10.6, but when they update if you use the same technique for migrating from non-sandboxed to sandboxed, they should be alright.

[quote=31089:@James A Smith]Over 90% of the user are on windows, I’ll need to program for that also.[/quote] Erm - migration won’t help them migrate to the Mac.

[quote=31089:@James A Smith]
I plan to do the Sandboxing thing in two version updates. ~ Second version/stage will do the migration thing, and sandbox.[/quote]
Seems very sensible and reasonable. While the concept of Sandboxing is a simple one, it has been painful for quite a few of us who already have apps in the App Store. So taking your time and certainly reading everything you can to get a grip on exactly how it affects apps is a good idea.

After giving more thought to the two stage upgrade to sandboxing I don’t think it would work in the long run. Someone may be running 10.6 now and a year or so gets a new mac with 10.8, my old app would still work (I think) as always, then they would update and it expected the DB to be in the app-data folder and would fail.

However you said the magic words: “ask the user”. I don’t why I didn’t think of that, I guess I just want to do everything I can without user intervention. So simple.

So I’ve droped the idea on two steps to sandboxing and just do it.

In setting up files to be migrated and a file is not there will the system give an error or just ignore it?

If I want to up my app in the App Store do I need App Wrapper or will App Wrapper Mini be sufficient?

Indeed it would be easier if you didn’t have to, and there may be a way, I just can’t think of one.[quote=31578:@James A Smith]In setting up files to be migrated and a file is not there will the system give an error or just ignore it?[/quote]
It will just be ignored.[quote=31578:@James A Smith]If I want to up my app in the App Store do I need App Wrapper or will App Wrapper Mini be sufficient?[/quote]
Mini should be sufficient, while it currently doesn’t support migration, I did help someone else out on this forum regarding migration recently. So I would suggest checking back on that first.

Thanks Sam