ios - Is there a way to check only first data byte from remote url using NSData? -


i've problem in context:

i receive url json options of images like:

var original    : string? var small       : string? var medium      : string? var large       : string? 

only original right exists, can big/heavy. want check if others size image exists. before create object check images this:

*(before call method check url string availability - url can exist without content)

func checkresourceisreachable(url: string) -> string{     var urlreachable = ""     let url: nsurl = nsurl(string: url)!      {         let data = try nsdata(contentsofurl: url, options: nsdatareadingoptions())         print(data)         urlreachable = string(url)     } catch {         print(error)         if let _ = original{             urlreachable = original!         } else{             urlreachable = "erro"         }     }      return urlreachable } 

but, way downloading data if existis (nsdatareadingoptions), so, knows way check first byte url content? couldn't find yet.

thanks in advance!


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -