So i am getting the error:
fatal error: unexpectedly found nil while unwrapping an Optional value
After some trail and error i think it has to do with let ent
see
func newItem(){
let context = self.context
let ent = NSEntityDescription.entityForName("InvoiceList", inManagedObjectContext: context)
print("New data \(ent) ")//outputs: New data nil
let nItem = InvoicesList(entity: ent!, insertIntoManagedObjectContext: context)
ent seems to be nil, but i can't use ent? as in
let nItem = InvoicesList(entity: ent?, insertIntoManagedObjectContext: context)
So how can i fix this? The core data entity InvoiceList has attributes but no values at start is this wrong?