0

I built an RSS parser in Swift 1.x and it worked fine. But I recently switched to Swift 2. When I execute the same code in Swift 2 .It gives

"Could not open data stream"

Even though the URL is correct. I tried several URLs and it also gives the same error.

Here is code:

let url:NSURL = NSURL(string: "http://api.androidhive.info/pizza/?format=xml")!
parser = NSXMLParser(contentsOfURL: url)!
parser.delegate = self
var result = parser.parse()
let error = parser.parserError

Update : It works fine only on this url (http://images.apple.com/main/rss/hotnews/hotnews.rss).

Tom Elliott
  • 1,908
  • 1
  • 19
  • 39

0 Answers0