Hello!
Last week I bought myself a course on udemy.com regarding the use of Core Data, however - as I followed the tutorial and downloaded the project-file it all went well. When I created a new project, and pretty much followed the tutorial once more. This time, I get an error each time I want to display sorted data (printing). This is my code in ViewDidLoad:
var context: NSManagedObjectContext!;
let predicate = NSPredicate(format: "name == '\(selectedName)'")
let request = NSFetchRequest(entityName: "Profile")
request.predicate = predicate
let result = (try! self.context!.executeFetchRequest(request)) as! [Profile]
dtm = try! self.context!.executeFetchRequest(request) as! [Profile]
for prof in result {
/
print(prof.name!)
}
This is however, the error I am getting:
fatal error: unexpectedly found nil while unwrapping an Optional value
It may be worth mentioning that my entity is called Profile, but I am not sure if I have the correct settings or not. I have tried everything I know about, and I really hope you can help me with this. Thank you.