我正在尝试将RSS Feed加载到IOS应用程序。经过大量的教程后发现以下内容,但它引发了异常。
来源:https://github.com/tichise/TIFeedParser
func loadRSS() {
let feedUrlString:String = "https://news.google.com/news?hl=us&ned=us&ie=UTF-8&oe=UTF-8&output=rss"
Alamofire.request(feedUrlString).response { response in
if let data = response.data, let _ = String(data: data, encoding: .utf8) {
TIFeedParser.parseRSS(xmlData: data as NSData, completionHandler: {(isSuccess, channel, error) -> Void in
if (isSuccess) {
self.items = channel!.items!
self.videoTableView.reloadData()//Exception on this line
}
if (response.error != nil) {
print((response.error?.localizedDescription)! as String)
}
})
}
}
}
异常是线程1:致命错误:展开一个可选值时意外发现nil
我做错了什么?如果是这样,请参考或如何解决?将会非常有帮助!