iOS Question Problem with SafariController

Discussion in 'iOS Questions' started by martin24, Oct 7, 2018.

  1. martin24

    martin24 Member Licensed User

    When I use the SafariController to open an URL, everything works fine.

    When I display a Message Box before opening that URL, the App completely hangs. I can can reproduce this with the latest version 5.30 and Hosted Builder.

    Below the code that does not work here. Any ideas what could be wrong?

    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 Page1 As Page
        
    Private Button1 As Button
        
    Private Button2 As Button
        
    Private Safari As SafariController
    End Sub

    Private Sub Application_Start (Nav As NavigationController)
        
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
        NavControl = Nav
        Page1.Initialize(
    "Page1")
        Page1.Title = 
    "Page 1"
        Page1.RootPanel.Color = 
    Colors.White
        NavControl.ShowPage(Page1)
        
        Button1.Initialize(
    "Button1", Button1.STYLE_SYSTEM)
        Button2.Initialize(
    "Button2", Button2.STYLE_SYSTEM)
        
        Button1.Text = 
    "OK"
        Button2.Text = 
    "Error"
        
        Page1.RootPanel.AddView(Button1, 
    10105050)
        Page1.RootPanel.AddView(Button2, 
    10705050)
    End Sub

    Sub Button1_Click
        Safari.Initialize(
    "safari""https://www.b4x.com")
        Safari.Show(Page1)
    End Sub

    Sub Button2_Click
        
    Msgbox2("Msg""Open?""Open"Array ("Yes""No"))
        
    Wait For Msg_Click (ButtonText As String)
        
    If ButtonText = "Yes" Then
            Safari.Initialize(
    "safari""https://www.b4x.com")
            Safari.Show(Page1)
        
    End If
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.

    Try to add Sleep(500) after the Wait For line.
     
    BillMeyer likes this.
  3. martin24

    martin24 Member Licensed User

    Thanks, that works.
     
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