The problem is that you are using a dictionary where value is of type AnyObject to populate the title and content properties, which are probably String (on the right?)
You cannot put that (at compile time) declared by AnyObject into the String property.
Just replace it
entity.title = article["title"] entity.content = article["content"]
with this
entity.title = article["title"] as? String entity.content = article["content"] as? String
Update
This updated file will discard articles in which the title and content values ββare incorrect. Strings.
for article in articles { if let title = article["title"] as? String, content = article["content"] as? String { let entity = NSEntityDescription.insertNewObjectForEntityForName("Article", inManagedObjectContext: DBHelper.context()) as! Article entity.title = title entity.content = content } }
source share