Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 15, 2017 7:23 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun May 27, 2012 6:13 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
Been thinking about Sandboxing Carbon application. The #1 problem with a Sandboxed Carbon application, is the open and save dialogs. They simply don't work and for some reason there are issues when you try to jimmy in the NS equivalents.

There may be other issues, I just don't know about them.

Anyway, I was toying with the idea of writing a Cocoa helper app to show dialogs, when I recalled that I can do this with Apple Script.

Lo and behold, it only friking works! I've posted a test application and the source code to my site, so you can see with your own eyes, a Sandboxed carbon application working!

http://www.ohanaware.com/appwrapper/san ... cation.zip

If you can help me test this and let me know if it works, or doesn't work for you. Are there any other carbon+sandbox issues that we should take a look at.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun May 27, 2012 10:39 am 
Offline

Joined: Fri Sep 30, 2005 10:01 am
Posts: 283
Location: Germany, Munich
Great idea. Had you only come up with this before my MAS talk last friday at Real World :)

I imagine the same could be accomplished by writing a tiny Cocoa app that handles this and then gets invoked by the RB app. But that would then require the use of XPC for communication, and I do not know how that works with RB yet.

Has anyone used XPC in RB yet, maybe even made a class for it available?

_________________
User of RB since first version. Provider of many free and outdated plugins.
Code for sharing: http://www.tempel.org/RB/Resources
Arbed, a unique tool for editing projects: http://www.tempel.org/Arbed
Zip compression classes: http://www.tempel.org/RB/ZipPackage


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun May 27, 2012 7:27 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
tempel wrote:
Great idea. Had you only come up with this before my MAS talk last friday at Real World :)

I imagine the same could be accomplished by writing a tiny Cocoa app that handles this and then gets invoked by the RB app. But that would then require the use of XPC for communication, and I do not know how that works with RB yet.

Has anyone used XPC in RB yet, maybe even made a class for it available?


I wish I'd come up with it last year, when I spent a week trying to figure out a solution!

I haven't seen XPC until you mentioned it. Maybe someone else has tried it, it looks very similar to the helper application framework I proposed to RS last year!

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 1:21 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Hello rowlands,
I've tried to download your zip file but I receive a 404 page. Can you send me the new link?

Thanks for all


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 1:41 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
I'll post it back up soon, right now however I've run into several show stopping issues when using a Sandboxed application on Mac OS X 10.7.2

Basically the users system needs to be slightly massaged to get it to work and then there appear to be no way to restore recent items.

It may appear that if you Sandbox your application, the safest way is to set the Minimum OS 10.7.3. Which is not good!

Oh a Sandboxed application seems to work fine on Mac OS X 10.6.8 and 10.5!

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 1:48 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
I am developing an application that requires the use of Carbon framework so I've need only of the open dialog for open a file or folder.


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 1:52 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
http://www.ohanaware.com/appwrapper/SandboxableApplication.zip

Is the current version of my Sandboxable application source code.

It includes the Carbon Sandbox Open and Save dialog code along with Security-scoped bookmarks, so that you can regain access to recent items on 10.7.3.

I've haven't written any help or text for this code yet.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 2:09 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Thanks my friend :-)
How i can choose the file type?
I write:
osa.Types = "video/quicktime;video/mpeg;video/msvideo;video/mp4;video/x-mpeg"

but can't select the files with this extension


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 2:21 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
Sorry, it appears that you need to use either the 4 character type or the UTI.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 2:49 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
so how can solve this problem? It's impossible to open more file type?


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 3:10 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
According to the UTCoreTypes.h

"public.audiovisual-content" is the core type, with "public.movie" being video & audio and "public.video" being just video (without audio).

"public.movie" covers Quicktime, MPG-4, MPG. Remember these are only core types, so hopefully the other movie formats will be included.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 3:25 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Perfect!
Thanks for all ;-)


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Sun Jun 10, 2012 8:30 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
You're welcome

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Mon Jun 11, 2012 11:30 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
Thanks for all your hard work on this Sam. I will be putting some of your code to the test to see if I can get an app through the MAS.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Carbon + Sanbox + Open and Save dialogs
PostPosted: Mon Jun 11, 2012 9:47 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
Bob Keeney wrote:
Thanks for all your hard work on this Sam. I will be putting some of your code to the test to see if I can get an app through the MAS.


Spend a while and examine the demo application I've posted. It'll show you how to replace the open and save dialogs with the OSADialog class (which is the only way I've found to do Open & Save in a Carbon Sandboxed application).

Take a look at the SandboxsafeRecentItems also, as this will show you how you can store file references that can be re-accessed in subsequent launches.

I'm sorry I haven't written any documentation yet.

Now the bad part, Mac OS X 10.7-7.2 are really bad with Sandboxed applications, by default they don't seem to like Carbon Sandboxed applications (immediately crash before any code is executed). Cocoa apps don't seem to have this problem, I've written to ADC hoping that Apple can show me if I'm doing something wrong.

Plus file references don't work at all on these versions of the Mac OS, at least not in my testing. Again I'm hoping Apple can shed some light (it seems these version already break file refs, without providing any secure method. 10.7.3 added a secure method, which works with my code). A temporary solution, might be to add a Temporary Entitlement allowing access to the whole drive. Although I haven't tested it yet.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group