iOS Question Panel click is working on debug not in release

Shay

Well-Known Member
Licensed User
Longtime User
This is working on debug mode

class_global:
private panel1 as panel

Sub Panel1_Click
PG.ResignFocus
HD.ToastMessageShow ("pressed",False)
End Sub

not in release, why? (not even toast is displaying)
 

stevel05

Expert
Licensed User
Longtime User
It works for me, what else do you have in the app?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I just tested again, also the button is not responding, clicking on it - nothing happen
only the TextFeilds are responding
I am using class and not modules
I am calling it like:
dim mypage as myclassx
mypage.initilize

moved to classes since I had other issue which pages are not cleared (once coming back to it, all the data was still there) so Erel told me to switch to classes
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I replaced the panel and the button in the layout for new button/panel and now this issue also happen in debug mode, so the log I get is:
Event target instance was released: panel1_click
Event target instance was released: button1_click
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
...And now it is working on debug mode (changed the page in main to public), but again not in release mode
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Can you post the project? Or one that shows the problem.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Event target instance was released: panel1_click
Event target instance was released: button1_click
These messages mean that the class instance that should handle the event was released because there were no live references pointing to it.

Make this class instance a global variable to fix it.
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Please clarify
you mean: sub global initialize?
since page as public did not help
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is hard to answer without going over your code.

You have created a class instance which should handle the layout events. You need to make sure that you keep a live reference to this class instance.

iOS doesn't have a powerful garbage collector such as Android / Java. It uses a much simpler mechanism (reference counting). It is your responsibility to keep references to your class instances.
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I will try to explain my code, try to guide me (since only in the evening I can create some demo code)
I have main module, in there I have the NAV as global and page as global
other "pages" are in classes, code is copied from standard module (I just changed the sub name from "show" to "initialize"

on the classes the page need to be public or private?
is it need to be same name as page in main?

let say the page I want to go called "registerC"
so I do from main:
dim register as registerC
register.initilize
<And here I have this issue>
on register initialize sub, I am using main.nav.showpage
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Thanks, I created public vars on main for each class
seems to solve the issue (still testing)
 
Upvote 0
Top