Я работаю над быстрым приложением, которое использует JSON с URL-адресом. Но при внесении изменений в JSON он не обновляется в приложении. Это код, я используюJSON не обновляется в быстром
let urlAsString = "http://domain/json.json"
let url = NSURL(string: urlAsString)!
let urlSession = NSURLSession.sharedSession()
let jsonQuery = urlSession.dataTaskWithURL(url, completionHandler: { data, response, error -> Void in
if (error != nil) {
println(error.localizedDescription)
}
var err: NSError?
var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as NSDictionary
if (err != nil) {
println("JSON Error \(err!.localizedDescription)")
}
var i = 1
while i <= jsonResult.count/2 {
let title = i.description + "t"
self.feeds.insert(jsonResult[i.description] as NSString, atIndex: 0)
self.feedst.insert(jsonResult[title] as NSString, atIndex: 0)
i++
}
dispatch_async(dispatch_get_main_queue(), {
self.tableView.reloadData()
})
})
jsonQuery.resume()
Я попытался сделать сом де-подслушивания и придумать, что проблема может быть в этой части:
var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as NSDictionary
Я думаю, что Apple, кэширование старого значения
Большое вам спасибо! – ntoonio