• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
standalone not logging in...
#1
Hi all,
I'm having difficulty with getting a standalone to use LiveCloud...

i've adapted the login set up from the 'create project' from LCM's toolkit dialog. I use the same interface/code and if successful login it navigates to another card. 

Inside LiveCode (Indy 9.6.1) this works great. 
However when building standalone this just doesn't work and no error is generated.

I've made sure all external files for the app and livecloud's required libraries are included.
In particular: Internet, tsNet, mergJSON, SSL & Encryption, as well as the app's CanelaDB toolkit folder are definitely included (I've also tried just adding the 3 subfolders of the /CanelaDB/ folder instead, but no difference)

I've added some debug code to try and figure out where the app fails in the standalone. 
Running the 'login' command below gets as far as calling cdb_auth, then nothing else happens in standalone, whereas in LiveCode it works as expected, completing the authorisation and navigating to the correct card. If i try to create a new account, nothing happens again.

The login code called by clicking 'log in' is (comments indicate what works inside LC and in Standalone)
Code:
command login
  local tInputA, tLayer, tAuthStatusA, temp
 
  if not _verifyLoginData() then
     exit login
  end if

  answer "about to send cdb_auth" //debug code -- this works in LC and Standalone

  get cdb_auth(fld "Email-input" of grp "login",fld "Password-input" of grp "login","User")
  put cdb_authStatus() into tAuthStatusA
 
  answer "Response: " & cdb_result("response")  //debug code -- does nothing in standalone; no response, no error. In LC this answers authorisation completed
 
  repeat for each key tKey in tAuthStatusA //debug code -- no response here either. In LC it answers cloud: true, local: true
     put tKey & ":" && tAuthStatusA[tKey] & return after temp
  end repeat
  answer temp
 
  if tAuthStatusA["cloud"] then
     go to card "card1" //works in LiveCode, but not standalone
  else if tAuthStatusA["local"] then
     go to card "card2" //works in LiveCode, but not standalone
  else
     answer "Error authenticating user:" && cdb_result("response")
  end if
end login

Based on this it seems like after cdb_auth, the process stalls somewhere in the standalone, as the next 'answer' debug line never fires but does inside LC.

Looking at my firewall, the app doesn't seem to be attempting to connect to the internet at all (according to Little Snitch)

What am I missing? Any help would be greatly appreciated...
  Reply
#2
Hi Stamatis,

It could be that you standalone does not have the libraries or they are in a path that does not align with the command initializeCanelaDB code the LCM provides you when you export your toolkit.

I am going to provide you the path for how this works in LiveCloud Manager and the init code we use for it.

You may need to adjust the pathing to work for the location where you placed your CanelaDB folder.

Path
/Users/mark/Desktop/Deployment/LCM Deployment/LiveCloudManager/LiveCloudManager.app/Contents/Resources/_MacOS/data/config/CanelaDB

LCM init code
command initializeCanelaDB
local tLibraryPath

wait 0 milliseconds with messages ## GIVE THE ENGINE A CHANCE TO SPIN UP
put "-" into gCDBAuthKey
set the itemDel to "/"

if the environment is "development" then
put item 1 to -2 of (the effective fileName of this stack) into tLibraryPath
else
switch the platform
case "android"
case "iPhone"
put specialFolderPath("engine") into tLibraryPath
break

case "MacOS"
put specialFolderPath("support") into tLibraryPath
put "/" & "CanelaSoftware/" & gCSManifestA["productName"] & "/" & gCSManifestA["productVersion"] & "/data" after tLibraryPath --LCM SPECIFIC PATH
break

case "Win32"
case "Linux"
put item 1 to -2 of (the effective fileName of this stack) into tLibraryPath
break
end switch
end if

put "/config/CanelaDB/libraries/" after tLibraryPath

if the environment <> "development" then
repeat for each line xLine in files(tLibraryPath)
if xLine <> "CDB_Header.lib" and xLine <> "CDB_Starter.lib" then
delete file (tLibraryPath & xLine)
end if
end repeat
else
if there is a file (tLibraryPath & ".DS_Store") then
delete file (tLibraryPath & ".DS_Store")
end if
end if

--START CanelaDB
csi_verifyLibraries tLibraryPath

try
start using stack (tLibraryPath & "CDB_Header.lib")
start using stack (tLibraryPath & "CDB_Starter.lib")

catch tError
answer "The CanelaDB SDK is missing. Please export your CanelaDB SDK again." && tError
exit to top
end try

--SET OPTIONAL LOGGING MODE
cdb_SetLogMode "message box"

cdb_loadTable "cdbCache"
end initializeCanelaDB
  Reply
#3
Thanks Mark,

I don't think that was it -- despite a couple of differences differences between the stack code in the toolkit and the code you provide, no error was being generated and nothing worked.

The differences with the toolkit code that i could see were the location of the SDK within the mac app bundle (according to your path above, the SDK is in /Contents/Resources/_MacOS/data/config/CanelaDB, whereas in my bundle it's in /Contents/Resources/_MacOS/CanelaDB. Also the stack script is slightly different - yours uses specialFolderPath("support"), whereas the stack script is specialFolderPath("resources") in case "MacOS"

Changing all of the above to match your script above made no difference whatsoever.
Then i decided to see if the startup script was even being triggered, by adding an answer dialog to state what environment was being detected in the preOpenStack script.
And then the login worked!

I wondered if the wait 0 milliseconds with messages needed a larger value, but removing the debug code didn't make a difference - it still works now.
I can only presume this is some kind of odd gremlin/corruption in my stack which has somehow ironed itself out. 

I'm now faced with other unexpected behaviour with the standalone (i've set the database to be local and sync from cloud on start up but this isn't happening now in standalone - only works inside liveCode) -- but that's a struggle for another day Smile
  Reply
#4
I figured the issue was around the init code. Code should work reliably every time. The reason for it working after adding a dialog is uncertain. I have some other thoughts that may or may not be of any use.

Are you running on Mac Catalina or Big Sur? Apple Notarization may be a factor.


Code:
case "MacOS"
put specialFolderPath("support") into tLibraryPath
put "/" & "CanelaSoftware/" & gCSManifestA["productName"] & "/" & gCSManifestA["productVersion"] & "/data" after tLibraryPath --LCM SPECIFIC PATH
break

You can see that we are accounting for that in the LCM startup with specialFolderPath("support"). Our startup code will not work well in standalones on systems running Mac 10.14 or newer. The best we can do is document how to modify the path to work with how people will deal with notarization. The database needs write permission. Mac developers will need to store their database outside of their standalone going forward. We chose to store our data in the 'Application Support'.
  Reply
#5
Thanks Mark,
I'm on Catalina, haven't made a move to big sur just yet - hadn't figured on notarisation, you may well be right - but on the other hand, the app shouldn't run at all if that were the case?

This attempt was an interim build to test something with the local database.
At present i sync cloud -> local on login... bit of a delay starting up, but subsequent actions much quicker. But on quit, the local DB seems to disappear - is that meant to be the case or am i doing something wrong?


It very much makes sense not to store the database inside the app bundle, and places like app support, documents or preferences seem a much better place for the SDK to reside. I had asked that exact question a while back anticipating this kind of issue but think that question just fizzled out and i didn't pursue it...

I know the documentation section on this will be updated at some point, but in the mean time, is the general idea that on first run the app will copy the SDK folder to a writeable destination? Not sure LCM does that at present, i could find no CanelaSoftware  folder in either my /Library/Application Support/ or my ~/Library/Application Support/ folders, but it there is a copy of this inside the LCM app bundle at   /Contents/Resources/_MacOS/data/config/CanelaDB.
Not sure where the  specialFolderPath("support") is used?

Anyway will keep working on the app inside LiveCode and will revisit this at some point later...
  Reply
#6
If you have not codesigned or notarized, you are probably not running write permission issues locally.

When the sync takes place, do you see the changes happening both locally and in the cloud? If so, we can rule out that the libraries are not loaded.
Your local data is automatically saved to disk for you. Do you have a cdb_loadTable (https://docs.livecloud.io/LoadTable/) in your code? It is possible that your data is not being loaded into memory on startup of your app. We used to do it automatically, but we received enough feedback indicating that developers wanted full control when the data was to be loaded. In our apps, we do not always load all the tables for a database in a single moment.

When you are ready to ship your app, you will want to have all your data and possibly code running from another location. We do both so we can auto-update the code. You will not be able to modify your code or data if stored in the bundle once the bundle is codesigned.

When we release our notarized version, you will find everything that is in resource folder moved over to the app support folder. This was managed not by LiveCloud, but from our SpiceKit libraries. Our SK libraries manage our auto-update and licensing tech.
  Reply
#7
(11-12-2020, 11:36 PM)mark_talluto Wrote: If you have not codesigned or notarized, you are probably not running write permission issues locally.

When the sync takes place, do you see the changes happening both locally and in the cloud? If so, we can rule out that the libraries are not loaded.
Your local data is automatically saved to disk for you. Do you have a cdb_loadTable (https://docs.livecloud.io/LoadTable/) in your code? It is possible that your data is not being loaded into memory on startup of your app. We used to do it automatically, but we received enough feedback indicating that developers wanted full control when the data was to be loaded. In our apps, we do not always load all the tables for a database in a single moment.

When you are ready to ship your app, you will want to have all your data and possibly code running from another location. We do both so we can auto-update the code. You will not be able to modify your code or data if stored in the bundle once the bundle is codesigned.

When we release our notarized version, you will find everything that is in resource folder moved over to the app support folder. This was managed not by LiveCloud, but from our SpiceKit libraries. Our SK libraries manage our auto-update and licensing tech.

Thanks Mark,
cdb_loadTable was probably the missing ingredient - i'll check that out but from your reply i'm guessing that will do the trick.
For now still working on the app in LC as there is still a huge amount of work to do and very little spare time to do it in! 
I'll experiment with storing the data in a safe/writable place, that's definitely going to be needed... thank you.
  Reply
#8
I'm on Android. My standalone all of a sudden started to do the exact same thing as above. Inside Livecode Indie 9.6.1, it logs in the user with absolutely no problem. It did work. It worked for several weeks on on both LC Indie and the standalone. Now, out of nowhere, it does not log any user in (including the developer auth user) on the standalone only.

I tried having the stack throw a message to show that it was indeed reaching the initializeCanelaDB command. The standalone does reach that command.

I also tried to throw a message to see if it was reaching the android environment. The standalone does reach that command.

All the usual settings and files are included (i.e., Internet, tsNet, mergJSON, SSL & Encryption, as well as the app's CanelaDB toolkit folder are definitely included) in the build.

Further, both the header and starter libraries are verified in the csi_verifyLibraries command.

Essentially, the standalone, like LC Indie, makes it through the the entire stack script without error, but the card script in just the standalone fails to login anyone in using the cdb_auth command.

I also created an entirely new project. I exported the toolkit and moved the stack into the same folder, along with all of its inclusions and files. And the new project does the same thing. cdb_auth works on LC Indie, but it does not work in the standalone.

Any help with why or how this is happening would be great!
  Reply
#9
Hi JereMiami,

Yesterday, we learned about an issue that will affect all Android (as far as we can tell) developers. LiveCloud servers use Let's Encrypt SSL certs.

Let's Encrypt has changed the SSL certs so that apps made in LiveCode before version 9.6.5 will not work.
https://letsencrypt.org/docs/dst-root-ca...mber-2021/

I'll make a general announcement in the forums to bring everyone's attention to this situation.

The solution is to rebuild your app in 9.6.5. We tested 9.6.5 in our Appli Player. Everything works as expected.

Please let us know if you have any problems.
  Reply
#10
Bug 
I am having the same issues when using LiveCode 9.6.3 with android. But when trying with LiveCode 9.6.5 (rc 1) it doesn't even get to the cdb_auth in my login script. I get an error trying to start up when testing the app on my android phone connected via USB.

Quote:We encountered an error while initializing CanelaDB: 573,33,1,tsNetLibUrlReuseConnection
253,33,1241,30,1,libraryStack
353,0,0,stack "/data/app/~~6iGhweJfYfAE3UYYJfopSw==/com.dricus.jobstarpro-7iYWRkhHuLf3no--Zbyzeg==/base.apk/CanelaDB/libraries/CDB_Starter.lib"

Am I overlooking anything? Any hints and tips are welcome.
  Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)