iOS Question TabStrip error

Discussion in 'iOS Questions' started by rfresh, Jul 14, 2019 at 5:42 PM.

  1. rfresh

    rfresh Well-Known Member Licensed User

    I'm trying to have a look at the TabStrip example but am getting an error on line 33 which has to do with the Main designer file.

    I'm not sure what the problem is.

    Thank you...

    Three attachments below.
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Please post the code and error message as text.
     
  3. rfresh

    rfresh Well-Known Member Licensed User

    OK, here is the error msg and the code:

    Error message:

    Application_Start
    Error occurred on line: 33 (Main)
    Target is null. Method called: _initialize:::
    Stack Trace: (
    CoreFoundation <redacted> + 252
    libobjc.A.dylib objc_exception_throw + 56
    CoreFoundation <redacted> + 0
    B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 192
    B4i Example -[B4ICustomViewWrapper AfterDesignerScript] + 2076
    B4i Example -[B4ILayoutBuilder loadLayout:::] + 2892
    B4i Example -[B4IPanelWrapper LoadLayout::] + 204
    B4i Example -[b4i_main _application_start:] + 1116
    CoreFoundation <redacted> + 144
    CoreFoundation <redacted> + 292
    B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
    B4i Example -[B4IShell runMethod:] + 448
    B4i Example -[B4IShell raiseEventImpl:method:args::] + 2172
    B4i Example -[B4IShellBI raiseEvent:event:params:] + 1580
    B4i Example __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
    libdispatch.dylib <redacted> + 24
    libdispatch.dylib <redacted> + 16
    libdispatch.dylib <redacted> + 1068
    CoreFoundation <redacted> + 12
    CoreFoundation <redacted> + 1924
    CoreFoundation CFRunLoopRunSpecific + 436
    GraphicsServices GSEventRunModal + 104
    UIKitCore UIApplicationMain + 212
    B4i Example main + 124
    libdyld.dylib <redacted> + 4
    )

    Code:

    Code:
    'Code module
    #Region  Project Attributes 
        
    #ApplicationLabel: B4i Example
        
    #Version: 1.0.0 
        
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
        #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
        
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
        
    #Target: iPhone, iPad
        
    #ATSEnabled: True
        
    #MinVersion: 7
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        Public App As Application
        
    Public NavControl As NavigationController
        
    Private MainPage As Page

        
    'Private TabStrip1 As TabStrip
        Private WebView1 As WebView
        
    Private TabPages As List
    End Sub

    Private Sub Application_Start (Nav As NavigationController)
        
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
        Dim nc As NavigationController
        nc.Initialize(
    "nc")
        NavControl = nc
        
    'NavControl = Nav
        MainPage.Initialize("MainPage")
        MainPage.RootPanel.LoadLayout(
    "Main")
        NavControl.ShowPage(MainPage)
        TabPages.Initialize
        
    Dim cs As CSBuilder
        
    Dim page1, page2, page3 As Page
       
       
        page1.Initialize(
    "page1")
        page1.RootPanel.LoadLayout(
    "Tab1")
        page1.Title = 
    "Bing"
        WebView1.LoadUrl(
    "https://www.bing.com")
        TabPages.Add(page1)
       
        page2.Initialize(
    "page2")
        page2.RootPanel.LoadLayout(
    "Tab1")
        WebView1.LoadUrl(
    "https://www.google.com")
        cs.Initialize.Font(
    Font.CreateFontAwesome(18)).Color(0xFF014E1C).VerticalAlign(-1).Append("Google ").Append(Chr(0xF17B)).PopAll
        SetAttributedTitle(page2, cs)
        TabPages.Add(page2)
       
        page3.Initialize(
    "page3")
        page3.RootPanel.LoadLayout(
    "Tab1")
        WebView1.LoadUrl(
    "https://www.duckduckgo.com")
        SetAttributedTitle(page3, cs.Initialize.Color(
    0xFFF46903).Append("DuckDuckGo").PopAll)
        TabPages.Add(page3)
           
        
    'TabStrip1.SetPages(TabPages)
       
    End Sub

    Sub TabStrip1_PageSelected (Position As Int)
        
    Log("Current page: " & Position)
    End Sub

    Sub SetAttributedTitle(page As Page, cs As CSBuilder)
        
    Dim lbl As Label
        lbl.Initialize(
    "")
        lbl.AttributedText = cs
        
    page.TitleView = lbl
    End Sub

    Private Sub Page1_Resize(Width As Int, Height As Int)
       
    End Sub

    Private Sub Application_Background
       
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Why is this line commented:
    Code:
    'TabStrip1.SetPages(TabPages)
    ?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice