iOS Question Object was not initialized

db0070

Active Member
Licensed User
Longtime User
I get this error when I go from Main Page to MyPage to another:-

Error Occured on Line: 0 (MyPage)
Object was not initialized (UILabel)

Yet, when I put a break point after the Show call, there is no error. What could be wrong?
 

db0070

Active Member
Licensed User
Longtime User
Below is the full message:-

Application_Start
Application_Active
Error occurred on line: 0 (Salat_Times)
Object was not initialized (UILabel)
Stack Trace: (
CoreFoundation <redacted> + 150
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
Learn Salat -[B4IObjectWrapper object] + 200
Learn Salat -[B4IViewWrapper setVisible:] + 44
Learn Salat -[b4i_salat_times _locmanager_authorizationstatuschanged:] + 788
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 292
Learn Salat +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1788
Learn Salat -[B4IShell runMethod:] + 496
Learn Salat -[B4IShell raiseEventImpl:method:args::] + 1768
Learn Salat -[B4IShellBI raiseEvent:event:params:] + 1332
Learn Salat +[B4IObjectWrapper raiseEvent:::] + 220
Learn Salat -[B4ILocationManager locationManager:didChangeAuthorizationStatus:] + 124
CoreLocation CLClientGetCapabilities + 23480
CoreLocation CLClientGetCapabilities + 5830
CoreLocation CLClientInvalidate + 988
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 216
CoreFoundation <redacted> + 1824
CoreFoundation CFRunLoopRunSpecific + 516
CoreFoundation CFRunLoopRunInMode + 108
GraphicsServices GSEventRunModal + 160
UIKit UIApplicationMain + 144
Learn Salat main + 108
libdyld.dylib <redacted> + 2
)
 
Upvote 0

db0070

Active Member
Licensed User
Longtime User
I added to all labels 'If xxxx.IsInitialized then ...' still I get the same error. I don't understand, because when the layout is loaded that should initiliaze all views. I do not add any view by code. And why it works when I put a break point on the last line at End Sub and then continue run?

B4X:
Public Sub ShowSalat
    If pg2.IsInitialized = False Then
        pg2.Initialize("pg2")
        pg2.Title = "Salat Times"
        pg2.Initialize("pg2")
        pg2.RootPanel.LoadLayout("salatcalc")
    End If
    Main.Page1_Resize(Main.ActivityWidth,Main.ActivityHeight)           

    Main.navControl.ShowPage(pg2)
    ActivityCreate
End Sub
 
Upvote 0

pedrocam

Member
Licensed User
Longtime User
I added to all labels 'If xxxx.IsInitialized then ...' still I get the same error. I don't understand, because when the layout is loaded that should initiliaze all views. I do not add any view by code. And why it works when I put a break point on the last line at End Sub and then continue run?

B4X:
Public Sub ShowSalat
    If pg2.IsInitialized = False Then
        pg2.Initialize("pg2")
        pg2.Title = "Salat Times"
        pg2.Initialize("pg2")
        pg2.RootPanel.LoadLayout("salatcalc")
    End If
    Main.Page1_Resize(Main.ActivityWidth,Main.ActivityHeight)         

    Main.navControl.ShowPage(pg2)
    ActivityCreate
End Sub

@db0070

I had the same problem. I fixed it by adding

pg2.RootPanel.LoadLayout("pg2")

before

NavControl.ShowPage(pg2)


Hope this helps
 
Upvote 0
Top