2 MAS Questions

Hi,
I have a couple of questions which hopefully someone can confirm for me.

  1. Is a MAS app allowed to write to the SpecialFolder.Temporary folder?

  2. I created the following shell command (used to open the default mail.app and attach a file as an attachment).
    Is this also allowed in a MAS app:

Dim EmailAttach as New Shell Dim theFilePath As FolderItem = SpecialFolder.Desktop.Child("file.txt") EmailAttach.Execute("open -a Mail " + theFilePath.ShellPath)

Thank you all in advance.

[quote=196793:@Richard Summers]Hi,
I have a couple of questions which hopefully someone can confirm for me.

  1. Is a MAS app allowed to write to the SpecialFolder.Temporary folder?

[/quote]

Yes

[quote=196793:@Richard Summers]2) I created the following shell command (used to open the default mail.app and attach a file as an attachment).
Is this also allowed in a MAS app:

Dim EmailAttach as New Shell Dim theFilePath As FolderItem = SpecialFolder.Desktop.Child("file.txt") EmailAttach.Execute("open -a Mail " + theFilePath.ShellPath)[/quote]

No

You’re welcome :wink:

Oh dear :frowning:
Thanks Sascha.

Regarding question 2, i tried to find more info on this restriction but i can’t find it anymore. Maybe they removed it?
Does anyone know for sure?

https://developer.apple.com/app-store/review/guidelines/mac/

Not sure if the sandbox will preclude doing the shell script

[quote=196793:@Richard Summers]2) I created the following shell command (used to open the default mail.app and attach a file as an attachment).
Is this also allowed in a MAS app:

Dim EmailAttach as New Shell
Dim theFilePath As FolderItem = SpecialFolder.Desktop.Child(“file.txt”)
EmailAttach.Execute("open -a Mail " + theFilePath.ShellPath)
[/quote]

[quote=196818:@Norman Palardy]https://developer.apple.com/app-store/review/guidelines/mac/

Not sure if the sandbox will preclude doing the shell script[/quote]

Almost all my 16 MAS apps use shell scripts. I do not know from where the legend that sandbox forbids shell is coming, but it is not true.

My issue is not really with using the shell, BUT using the shell to insert a file as an email attachment?
I thought maybe there is some strange reason why an app would not be allowed to insert files into other apps?

Hence why I specifically said
Not sure if the sandbox will preclude doing the shell script

[quote=196825:@Norman Palardy]Hence why I specifically said
Not sure if the sandbox will preclude doing the shell script[/quote]

You were right. I am sure it does not, that all I was saying. At least as long as one does not try to write to forbidden places.

[quote=196820:@Richard Summers]My issue is not really with using the shell, BUT using the shell to insert a file into an email attachment?
I thought maybe there is some strange reason why an app would not be allowed to insert files into other apps?[/quote]

You know what Richard ? Do like shoes. Try it on. I bet it works just fine.

@Michel,
Thanks - I will try my shoes on, and see if my app gets accepted as a result :slight_smile: :slight_smile:

Thanks Michel.
I know that writing files to certain folders is off-limits, so I thought maybe inserting email attachments would also be off-limits?

But when the update is ready, I will submit it and see what happens.

Thanks.

Looking at your shell code, I am afraid the sandbox will not let you launch Mail as you seem to want to do.

Why don’t you use SMTPSocket with EmailAttachment instead ?

http://documentation.xojo.com/index.php/SMTPSocket
http://documentation.xojo.com/index.php/EmailAttachment

That’s what I feared :frowning:
I guess I will have to look into the 2 links you just posted.

Thanks.

[quote=196828:@Richard Summers]@Michel,
Thanks - I will try my shoes on, and see if my app gets accepted as a result :slight_smile: :)[/quote]

More often then i like, i just did it this way. And more often then i expected, all went fine :wink:

[quote=196793:@Richard Summers]2) I created the following shell command (used to open the default mail.app and attach a file as an attachment).
Is this also allowed in a MAS app:[/quote]
I don’t use the console to launch a document in Mail, but you are allowed to do so.

Ideally you should be using NSSharingServices, but that’s broken on Yosemite for 32-Bit applications and is buggy for 64-Bit application as it claims it can’t send anything!

I use the following API from NSWorkspace in MAS applications and haven’t been rejected for it yet.

Function launchWithApp(extends f as folderItem, appName as string) As boolean #if TargetCocoa then Declare Function NSClassFromString Lib "AppKit" (className as CFStringRef) As Ptr declare function sharedWorkspace lib "Cocoa" selector "sharedWorkspace" ( classRef as Ptr ) as Ptr declare function openSeasame lib "Cocoa" selector "openFile:withApplication:" ( wrkSpace as Ptr, filePath as CFStringRef, appName as CFStringRef ) as Boolean Return openSeasame( sharedWorkspace( NSClassFromString( "NSWorkspace" ) ), f.nativePath, appName ) #endif End Function

@Sam,
Thanks!

I put that code into a method in Window1, then used the following code in a button’s action event:

Dim fi As FolderItem = SpecialFolder.Desktop.Child("test.txt") launchWithApp(fi, mail)

I then got the following 2 error messages:

I am currently not at my Dev.Desk, but how about writing “Mail.app” instead of “mail”? Does it work?

Sorry I didn’t include any instructions.

#1 Try wrapping “Mail” with quotes.

Dim fi As FolderItem = SpecialFolder.Desktop.Child("test.txt") launchWithApp(fi, "Mail")

#2 This function is designed to be stored in a module, not a class. Sorry about that. You can either put it into a module or remove “extends” from the method declaration.

Function launchWithApp(f as folderItem, appName as string) As boolean

Thanks Sam.

I removed “extends” from the method declaration, (it’s in a method of Window1).
I also put quotes around “mail”, and now I only get this error message:

DIM result As Boolean = launchWithApp(fi, “mail”)