iOS Question Storing an app's global variables

davemorris

Active Member
Licensed User
Hi Guys
For B4i, is it safe to keep global variables in any code module (within the Process_Globals sub).


Kind regards
Dave
 

Erel

Administrator
Staff member
Licensed User
Yes.

BTW, this is also the case in B4A. A common mistake in B4A is to have a ***public*** global variable in the Main module that is initialized in Activity_Create when FirstTime is true.

Don't assume that the app will start from the main activity. This is exactly why the Starter service was created.

This is not an issue in B4J or B4i as the program always starts from the main module.
 

davemorris

Active Member
Licensed User
Hi Erel
Thanks for the quick response (its nice to know the B4i Main module will always run first) - but the question relates to B4i, can I rephrase the question.

For B4i, is it safe to keep global variables in ANY code module (within ITS Process_Globals sub).

Kind regards
Dave
 

davemorris

Active Member
Licensed User
Hi Erel
Thanks again - That will help greatly in my efforts to make code more X-platform (B4A/B4I) friendly.

Kind regards
Dave
 
Top