Cannot get the dictionary from NSUserDefaults as saved format

I want to get a swift dictionary from NSUserDefaults as the format that I've saved before. I've saved the dictionary as [String:String] format, but while I'm getting the dictionary with dictionaryForKey(key) method I got [String:AnyObject]?. How can I convert [String:AnyObject]? to [String:String] or how can I get the dictionary in right format?

Saving to NSUserDefaults

var tasks: Dictionary<String,String> = [:]
let defaults = NSUserDefaults.standardUserDefaults()
let key = "key"
defaults.setObject(tasks, forKey: key)

Getting from NSUserDefaults

let defaults = NSUserDefaults.standardUserDefaults()
let key = "ananZaa"
let incomingArray = defaults.dictionaryForKey(key)


If you've registered it with a default value so it never can be nil, just downcast it to the proper type

let defaults = NSUserDefaults.standardUserDefaults()
let key = "ananZaa"
let incomingDictionary = defaults.objectForKey(key) as! Dictionary<String,String>

Need Your Help

Output of GET request different to view source

go get

I'm trying to extract match data from When I view the source on firefox, I find on line 816 a big json string with the data I want for that matchid. My goal is to eventually get this...

AVPlayer and client transparent origin switching

ios avplayer http-live-streaming

I'm developing iOS app which uses HLS. In our video platform we use Nginx proxy_pass module for redirecting from one origin to another when one of them becomes unavailable (at all we have 2 origins).