I’am trying to connect to a MySQL database using the MySqlCommunityServer etc, etc.
When I build the program and then Run it it works fine.
However when I try to run and debug it, then the connection fales.
On Sonoma both ways work fine.
This is the third time I switched to Sequoia and thougt the problem must be solved by now.
Who has a solution for this problem or perhaps a workaround or do I have to stick with Sonoma?
I tried to read this, but this is beyond my knowledge.
Perhaps I will install a testing DataBase on my coding computer.
Than I have access to this testing DataBase when debugging without any problem.
In case of Building the program, I will connect to the local server.
You need to add an entitlement to the info.plist file of your app. Something like this:
<key>NSLocalNetworkUsageDescription</key>
<string>Verbindung mit einem (lokalen) Datenbankserver aufnehmen. Connect to a (local) database server.</string>
And it would be a good idea to keep in mind that your first connection attempt may be blocked by macOS, asking the user to confirm local network access…
I tried to insert that in the property list of the program, but it did not work.
The question box asked to trust the connection, but after that the database was not connected
even after 10 trials.
Does your program try to establish the connection every time it starts (in an opening event)? If so, try to establish the connection manually. E.g. with a button - after the program is already running in debug mode.
I had this exact same problem. Database connections stopped opening in Sequoia. I put in both “NSLocalNetworkUsageDescription” and “NSNearbyInteractionUsageDescription” into the app’s plist, but that didn’t have any effect. Same symptom in both debugger and built app.
The only way I solved it was a terrible kludge, which is to open the database, and if that opening fails, I show a modal dialog that just says “Click OK to continue.” When that dialog is dismissed by the user, I try opening the database again, and that time it works.
I’m guessing that this gives the system time to check the entitlements after the first database open attempt.
I suppose I could use a timer instead of a dialog, but then I’d have to put the database class into a thread which would mean a lot of refactoring.
This really is a dumb workaround and I’m hoping someone can point me at a better solution.
PS: even though I’m hardly ever active on this forum these days, I still think Xojo is a fantastic solution and I use it whenever possible for my hobby projects.
This makes it sound like the local-connections “security” measure Apple added. Apps aren’t able to make network connections for a few seconds after launch and no one knows why. This “alert the user and retry” method is the only thing that works.
I deal with it daily in Lifeboat since my debug server is a local Pi. Every single launch the auto connect fails. Occasionally, my production instance fails the first local attempt even though it’s not automatic (app launches, window shows, I manually connect to a server).
I don’t have any better suggestions. Alert + retry is what I do.