Program does not work after deployment

Hi,

I am lost. I have completed my first program. I have compiled it for macOS X and Windows. I want to share this program as “freeware” with some of my friends. There is no commercial idea behind it. To deploy my program I just zip the content of the build folders. I do not want to have an installer or DMG file or something like this. After unzipping the file the programs - the one for macOS X and the one for Windows - both work properly. But if I upload the zip file to my cloud, download it from there again and unzip it afterwards only the Windows version of the program works properly. The macOS X version does not work at all. What’s wrong with my process?

Best regards,
Gerson Nerger

What Xojo version is used to build the application ?

What version of the running OS (where it does not works) ?

What happens beside “does not works” ?

The app was built with the newest Xojo version: 2017 r2 …
The version of the OS where my app does not work is: macOS Sierra / 10.12.6 (newest)
Error description: On program start the software should write a small sqlite database, if it does not find this database in the program folder. The software does not write the database. Even if I provide the database in the program folder the software does not work properly. I get the database error “An exception of class NilObjectException was not handled. The application must shut down.”.

If you try to locate a file in your app you should have code if the file isn’t there. Can you post how you create or open the SQLite database?

Oh, here is the problem: “in the program folder”. This won’t work on the Mac. You won’t have write permission there. Save the SQLite file somewhere in the user documents folder.

[quote=347729:@Gerson Nerger]Hi,

I am lost. I have completed my first program. I have compiled it for macOS X and Windows. I want to share this program as “freeware” with some of my friends. There is no commercial idea behind it. To deploy my program I just zip the content of the build folders. I do not want to have an installer or DMG file or something like this. After unzipping the file the programs - the one for macOS X and the one for Windows - both work properly. But if I upload the zip file to my cloud, download it from there again and unzip it afterwards only the Windows version of the program works properly. The macOS X version does not work at all. What’s wrong with my process?

Best regards,
Gerson Nerger[/quote]
Have you Run your app on the Mac? It might show you the error in the debugger.

Hello,

i think you are running into the App Transloaction “Security” feature of the modern MacOS Version Sierra & High Sierra.

You will have to think about Signing your Mac App or tell Your Users (& Your Self) to clear the “Quarantine?” Security-Bit of the “Re-” Downloaded App. After Extracting the ZIP File.

@Beatrix: Here is the code for writing the database.

[i]dim f as FolderItem = GetFolderItem (“settings_database.sqlite”)
dim sdb as new SQLiteDatabase
dim sdbsql as string
dim datasdb as RecordSet
sdb.DatabaseFile = f

if not f.Exists then
If sdb.CreateDatabaseFile Then
sdb.SQLExecute(“CREATE TABLE Settings (ID INTEGER, rbtWeight INTEGER, rbtElevation INTEGER, rbtPressure INTEGER, rbtTemperature INTEGER, PRIMARY KEY (ID))”)
Dim row As New DatabaseRecord
row.Column(“rbtWeight”) = “1”
row.Column(“rbtElevation”) = “0”
row.Column(“rbtPressure”) = “1”
row.Column(“rbtTemperature”) = “1”
sdb.InsertRecord(“Settings”, row)
If sdb.Error Then
MsgBox("DB Error: " + sdb.ErrorMessage)
End If
end if
end if

sdbsql = “SELECT * FROM Settings”

if sdb.connect then
datasdb=sdb.sqlselect(sdbsql)
If datasdb <> Nil Then
rbtWeight(datasdb.field(“rbtWeight”).Value).value = true
rbtElevation(datasdb.field(“rbtElevation”).Value).value = true
rbtPressure(datasdb.field(“rbtPressure”).Value).value = true
rbtTemperature(datasdb.field(“rbtTemperature”).Value).value = true
else
MsgBox("Connection error: " + sdb.ErrorMessage)
end if
end if
[/i]

Thanx for your advice regarding the write permission. I am going to rewrite the code for saving the database in the “documents folder”.

@Greg: The app runs fine on my iMac but only if I had not uploaded and downloaded the zip-file with the app anywhere. If I zip and unzip it on my Mac the app works properly. If I upload, download and unzip the file on my Mac the software will not work. In the debugger I have no error messages.

@Ren: Indeed I had the warning that the software is from an unknown developer (or like the phrase is) … But I answered it with yes, that I want to use it …

When you upload the file, assuming it’s SFTP or FTP, are you sending it as binary or ascii?

Yes.
But the App still get’s Translocated. (Even if the App it self will start!)

You would still ned to remove The Quarantine Bit to stop transloaction.
1.

xattr -d com.apple.quarantine <Path/MyApp>

[quote] Same Post as 2:
Btw: The workaround for a translocated App is as easy as:

move App to Desktop
move App back to it's directory

-> no longer translocated
[/quote]

  1. Codesigning & other things
    (For Example via App Wrapper)

@Ren: Yep, it’s the security thing. After I moved the app to the desktop and back to the folder it worked as wanted.

Thanks@all for your input! Cool community!

Best regards from Germany,
Gerson Nerger

Yes, that is the easiest way to solve this issue.

This security feature moves the app to a random folder and runs it from there. So that is where his app created the database. Supposedly this is an attempt to avoid clean apps from being tricked into using malware files.

I think one is going to have to have a marker file sitting next to the app; if the app doesn’t find that it can warn the user to move the app to the Desktop and back again (and then it will need to quit).

You can use build automation to always sign your app or just a little shell script to do this.
Your users should never need to work around the security system.