iOS Question Errors not logging?

awoo060

Member
Licensed User
Longtime User
Hey everyone, Im just trying to port a pretty hefty application over to b4i from b4a and am getting tripped up at the first hurdle.

Below, on the line where I am re-adding all my controls to the scrollview, it is crashing out of the debugger altogether and won't show me any error messages in the log window, nor will a breakpoint hit within the catch statement. Consequently, I am being given no information on what I am doing wrong.

I've a hunch that the fact I'm mucking around in Application_Start has something to do with it, but am still concerned as to why the debugger/application can't tell me this in the Log. Instead it just crashes out altogether which is of no help diagnosing what is going on.

Is there something obvious that I've missed?

Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.HideBackButton = True
Page1.RootPanel.Color = Colors.White
Page1.RootPanel.LoadLayout("main")
NavControl.ShowPage(Page1)

ScrollView.Panel.Initialize("")
Dim h As Rect
For Each c As View In Page1.RootPanel.GetAllViewsRecursive
h.Initialize(c.Left, c.Top, c.width, c.height)
c.RemoveViewFromParent
Try
ScrollView.Panel.AddView(c, h.Left, h.Top, h.Width, h.Height) 'Crashes the app here.
Catch
Log(LastException) 'Can't hit a breakpoint here. Nor does anything so up in the log
End Try


Next
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

I'm not sure why it crashes the debugger. If you like upload a small project with the relevant code and I'll test it.

Removing the views in the For Each block is problematic. I'm not sure what you are trying to do but instead you should call Page1.RootPanel.RemoveAllViews after the loop.
 
Upvote 0

awoo060

Member
Licensed User
Longtime User
Thanks erel. I figured it out after a while, but it didn't answer the real question of why the debugger wasn't logging errors.
One of the views included in GetViewsRecursive is the ScrollView itself. So its trying to add a ScrollView to a ScrollView which it crashed on.
Similar such (idiodic) errors I've found with b4a have similar effects - the IDE gracefully captures most errors but not all... never taken up too much of my time though.
 
Upvote 0
Top