iOS Question Strange problem with code

Brian Robinson

Active Member
Licensed User
Longtime User
Hi All,

I am currently converting my iPark app from Android to be used on the iPhone, but I have hit a major snag and was hoping for some help. I have pulled what I can out of my app and built a test app that shows the same behaviour. The problem I have is that when I run the app on my device with the debugger and I don't set any break points it has a problem parsing the JSON file. When I set break points and step through the code it parses the JSON correctly and creates all my objects as they should be. I have also tried creating a release build and that also fails. I was hoping someone could replicate this problem using the test app I have attached. Thanks for any help you can give.

Cheers
Brian
 

Attachments

  • ParkingReader.zip
    5.9 KB · Views: 194

Brian Robinson

Active Member
Licensed User
Longtime User
Ahhh... Ok, my mistake. I thought they were sort of overridable like a normal constructor, but when I think about it logically, they can't be. I always assumed that unless you were doing something in the Initialize sub you didn't need to call it, but only Dim it. I guess what I should be doing is calling the actual constructor "Initialize" in my Initialize2 Sub (but is there a problem with that, can't access my computer at the moment to test, but I have a feeling I have tried that before). I do still need a sub that creates an instance of the class that remains blank.

Can you tell me why the code works when I step through it in the debugger, and not when I step over it? Very interested in this, even if the response is complicated.

Thanks so much for your help with this one Erel, I was pulling at hair I no longer have. The strange thing was that I just pulled the code from my B4A project, but I will have to look again to see if I did any refactoring and stuffed it up.

Cheers
Brian
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can you tell me why the code works when I step through it in the debugger, and not when I step over it? Very interested in this, even if the response is complicated.
The rapid debugger is made of several layers. When there is no breakpoint (and the sub code is "up to date") the execution path used is a different, much faster, path. So in come edge cases the behavior can be different.
 
Upvote 0

Brian Robinson

Active Member
Licensed User
Longtime User
Hi Erel,

Thanks for the answer. I understand, I find similar circumstances with the .Net debugger when optimisations are turned on.

The fix worked for the demo app, but not for the actual app, I guess I will have to go through and check if there are othe itemsI
Just to clarify as well for others, I was able to call the Initialize sub from within the Initialize2 sub. I thought I had experienced a problem doing this before in B4A, but I was wrong.

I did check the B4A code and it isn't calling the Initialize, so not sure how it works.

Just writing these ramblings in case someone else has the same problem

Cheers
Brian
 
Upvote 0
Top