iOS Question Cannot connect to the internet from any app built with B4i - Not event B4i bridge connects

hatzisn

Expert
Licensed User
Longtime User
Here is exactly what I see:

 
Last edited:

hatzisn

Expert
Licensed User
Longtime User
What I mean is that the httpjob does not act as it is supposed to... And neither B4i bridge does (I can understand that it connects to the local LAN). Any suggestions?
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
The network problem should be in the iPhone 5S because as I wrote in previous thread I was able to connect successfully from the IDE to an iPhone 6 from the same computer. But shouldn't the HttpJob be firing the connection timeout error?
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
This video shows two things:
1) Problem in connection to B4i bridge
2) Compilation of an app in release mode with the highlighted code which should have been firing the Connection Timeout Error

Take a closer look at the code:

B4X:
'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: False
    #MinVersion: 7
#End Region
    #PlistExtra: <key>UIViewControllerBasedStatusBarAppearance</key><false/>


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
    Dim hd As HUD
    Private cmdTrial As Button
    Private pnlBackground As Panel
    Dim tm As Timer
    Dim iCount As Int
    Dim ts As TTS
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
    Page1.RootPanel.LoadLayout("1")
    NavControl.NavigationBarVisible = False
    NavControl.ShowPage(Page1)
    iCount = 0
    tm.Initialize("tim", 1000)
    ts.Initialize("ts1")
    tm.Enabled= False
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
End Sub

Sub ts1_Complete (Text As String)
 
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    CommoniOSFunctions.SetGradientHorizontal(pnlBackground, Colors.Blue, Colors.White)
 
    Dim sMessage As StringBuilder
    sMessage.Initialize
    sMessage.Append(CommoniOSFunctions.GetAppName & "-" & CommoniOSFunctions.GetDeviceName & "-" & _
        CommoniOSFunctions.GetDeviceModel & "-" & CommoniOSFunctions.GetDeviceSystemName & "-" & _
        CommoniOSFunctions.GetPackageName & "-" & CommoniOSFunctions.GetIMEI & "-" & _
        CommoniOSFunctions.GetVersion  & "-" & CommoniOSFunctions.GetUDID)
    Dim hj As HttpJob
    hj.Download("https://<<<<onlineserver>>>>.gr/getip.aspx")
    hj.GetRequest.Timeout = 5000
 
    hd.ToastMessageShow("Just before Wait.", True)
    Wait For (hj) JobDone(job As HttpJob)
 
    hd.ToastMessageShow("Just after Wait.", True)
    If job.Success Then
        Msgbox(job.GetString, "IP")
    Else
        Msgbox(job.ErrorMessage, "IP")
    End If
    job.Release
    hj.Release
 
    Msgbox(sMessage.ToString, "Device Info")
End Sub

Sub tim_Tick
    iCount = iCount + 1
    If iCount = 5 Then
        cmdTrial.Enabled = True
        iCount = 0
        tm.Enabled = False
    End If
End Sub

Private Sub Application_Background
 
End Sub

Sub cmdTrial_Click
    cmdTrial.Enabled = False
    ts.SetLanguage("el")
    ts.Speak("Αυτή είναι μία πρόταση στα Ελληνικά.", False)
    ts.SetLanguage("it")
    ts.Speak("Questa è una frase in Italiano... Spero che si ascolta bene.", False)
    ts.SetLanguage("en")
    ts.Speak("This is a frase in English. Let's see how it will be heard.", False)
    ts.SetLanguage("de")
    ts.Speak("Ich bin der Lehrer. Sie sind Studenten.", False)
    tm.Enabled = True
End Sub
 
Last edited:
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I agree that there are some problems in B4i created apps in communications but how can I explain the fact the it loads the www.timeanddate.com web site from safari as seen in the video from the same network? And since the error you say it is in Network shouldn't the HttpJob identify that it was not possible to connect within the TimeOut period (= 5000ms) and fire the connection timeout error?
 
Upvote 0
Top