Use of undeclared type 'Transcription'
I'm following this simple tutorial of Core Data in Swift 3 (https://learnappdevelopment.com/uncategorized/how-to-use-core-data-in-ios-10-swift-3/)
and I get the above error on the line: let fetchRequest: NSFetchRequest<Transcription> = Transcription.fetchRequest()
I double checked and the Entity "Transcription" is spelled correctly in my .xcdatamodeld file
The tutorial was designed for Swift 3, but there was another change since it was released that I fixed, so I'm guessing some other change to Swift in the past 2 months has caused this error.
I'm brand new to Core Data, so I don't know how to debug this. I'd be very grateful for a solution!
In my case, Xcode
wasn't finding the automatically generated class, which is something like that:
//
// Teste+CoreDataClass.swift
//
//
// Created by Laura Corssac on 2/2/20.
//
// This file was automatically generated and should not be edited.
//
import Foundation
import CoreData
@objc(Teste)
public class Teste: NSManagedObject { }
After quitting Xcode
and reopening it, my problem was solved.
Dont forget import CoreData
to your subclass
This happened possibly as Xcode is unable to determine the path of the .xcdatamodel
, a related error can be seen when cleaning the the project. This error happen to one of my project when changing the name of the .xcdatamodel
.
Resolution involves the following:
.xcdatamodel
-> Show in Finder
.xcdatamodel
to import to the project, a new entry should be created.xcdatamodel
entry.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With