Use of unresolved identifier ‘self’

This error message appears in App/Delegate.swift shown below:


    func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {

        // Save changes in the application’s managed object context before the application terminates.

        let context = persistentContainer.viewContext


        if !context.commitEditing() {

            NSLog(“(NSStringFromClass(type(of: self))) unable to commit editing to terminate”)  <-- ERROR OCCURS HERE

            return .terminateCancel



Why am I getting this error, and how do I correct it?

Powered by WPeMatico


You may also like...

Comments are closed.