iOS Question Error using job.download

Discussion in 'iOS Questions' started by salvadoro, Apr 19, 2019.

  1. salvadoro

    salvadoro Member Licensed User

    Hi i receive this error when trying to download this image https://taco-drive.com/assets/profile/RES002.jpg

    ResponseError: unsupported URL, status code: 0

    Code:
    Dim Job As HttpJob
    Job.Initialize(
    "Image", Me)
    Job.Download(
    "https://taco-drive.com/assets/profile/RES002.jpg")


    There is some kind of bug cause the link is right or i doing something wrong
     
  2. Semen Matusovskiy

    Semen Matusovskiy Well-Known Member Licensed User

    Try an attached code.
     

    Attached Files:

    • 1.zip
      File size:
      2.2 KB
      Views:
      23
  3. aeric

    aeric Active Member Licensed User

    I tested with no error. Since you didn't provide a complete code, it is difficult to guess what you have done wrong.
     
  4. aeric

    aeric Active Member Licensed User

    Here is my version

    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: 8
    #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

    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)
        
        
    Dim imgProfile As ImageView
        imgProfile.Initialize(
    "imgProfile")
        Page1.RootPanel.AddView(imgProfile, 
    100dip100dip100dip100dip)
        
        
    'Dim Job As HttpJob
        'Job.Initialize("Image", Me)
        'Job.Download("https://taco-drive.com/assets/profile/RES002.jpg")
        
        
    Dim strLink As String = "https://taco-drive.com/assets/profile/RES002.jpg"
        DownloadImage(strLink, imgProfile)
    End Sub

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

    Private Sub Application_Background
        
    End Sub

    Sub DownloadImage(Link As String, iv As ImageView)
        
    Try
            
    Dim job As HttpJob
            job.Initialize(
    "Image", Me)
            job.Download(Link)
            
    Wait For (job) JobDone(job As HttpJob)
            
    If job.Success Then
                iv.Bitmap = job.GetBitmap
            
    Else
                iv.Bitmap = 
    LoadBitmap(File.DirAssets, "noimg.png")
            
    End If
            job.Release
        
    Catch
            
    'Log(LastException)
            iv.Bitmap = LoadBitmap(File.DirAssets, "noimg.png")
        
    End Try
    End Sub
     

    Attached Files:

    Erel likes this.
  5. salvadoro

    salvadoro Member Licensed User

    Thanks for your help using this 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