2016년 12월 31일 토요일

Passing variables with TinyDB seems to fail when App is built


Working with a group of disabled students on a variety of apps. An interesting problem has occurred in several of these apps where we are using TinyDB to pass values between screens. This ranges from values used to control which colour schemes to use on screens, or a simple login system using one variable signifying Logged in (True) or Not logged in (False).

The problem is that when we are testing through the MITAI2 Companion everything works fine - Pictures appear, colour changes work, the Login is fine (hiding/revealing content depending on value), however when we build the final App these things no longer work.

As a test in one app I got a message to appear on the screen stating if security was on or off after using the login screen. In the Companion the message changes to 'Security is Off' after the login. Build the app and install then run and this doesn't happen - the message states 'Security is On'. Note. On the login screen itself a RED square appears if you are not logged in and once your username and Password are checked the square turns to green - this display bit works fine in the built App, but you are still not logged in when you return to the previous screen.

Whats happening differently beween the test stage and the final App? Any ideas?

--
What might have happened is that while you are developing and testing the TinyDB becomes populated with data. However, after you built the app, the TinyDB will be empty. Therefore, if your app depends on data being there, then you must do some initialization the first time the app starts. And save that you have done that in th TinyDB.

--
An initial screen setups the values to be stored in TinyDB by the App, then any changes are updated on the various screens, so the TinyDB isn't empty at any point.

-- 
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

-- 
Something else must go wrong then. Could you provide an .aia to look at?

--
Attached is one of the students project Apps. This is one where the login works in development but not when the final app is built.


-- 
Probably your problems is this: screen handling is not the same when you use the companion or a built file.
When you return from the login, you expect to do the Mainscreen.initialize again, but since you did not close the Mainscreen, that does not happen.
Start using when ... otherScreenClosed, or always close the screens directly after you called another screen.

Read Taifun's tips on this:

-- 

댓글 없음:

댓글 쓰기