I need to parse some data from rss and open related links from parsed rss in swift 2, for example i want to check this link is valid or not:
rtmp://185.23.131.187:1935/live/jomhori1
or this one :
http://185.23.131.25/hls-live/livepkgr/_defint_/liveevent/livestream.m3u8
My code to check the validation of the url :
let urlPath: String = "http://185.23.131.25/hls-live/livepkgr/_defint_/liveevent/livestream.m3u8"
let url: NSURL = NSURL(string: urlPath)!
let request: NSURLRequest = NSURLRequest(URL: url)
let response: AutoreleasingUnsafeMutablePointer<NSURLResponse?>=nil
var valid : Bool!
do {
_ = try NSURLConnection.sendSynchronousRequest(request, returningResponse: response)
} catch {
print("404")
valid = false
}
I've searched the web but all the method I found wasn't helpful for my issue.