Swift 3 почему не хочет парить json c http. 2 одинаковых файла а парcит только с https
func fetchArticles(){
let urlRequest = URLRequest(url: URL(string: "https://api.myjson.com/bins/my4j")!)
let task = URLSession.shared.dataTask(with: urlRequest) { (data,response,error) in
if error != nil {
print(error)
return
}
self.articles = [Article]()
do {
let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! [String : AnyObject]
if let articlesFromJson = json["results"] as? [[String : AnyObject]] {
for articleFromJson in articlesFromJson {
let article = Article()
if let title = articleFromJson["title"] as? String {
//article.author = author
//article.desc = desc
article.headline = title
//article.url = url
//article.imageUrl = urlToImage
}
self.articles?.append(article)
}
}
DispatchQueue.main.async {
self.tableview.reloadData()
}
} catch let error {
print(error)
}
}
task.resume()
}