"Cannot find 'EntityName' in scope" in parent app with development pods

45 Views Asked by At

I am using core data in my child app. Used podspec file to link my child app with parent app as development pods.

Child app is working file with core data. Here Child is an entity in core data.

But while building parent getting below errors as Cannot find 'Child' in scope

import CoreData
import Foundation
import SwiftUI

class CoreDataService {
    static let shared = CoreDataService()
    lazy var stack: CoreDataStackType = CoreDataStack()

    private init() {
        // private init
    }

    func insertChildItem(name: String) {
        guard let context = stack.context else { return }
        let child = Child(context: context) // ==> Cannot find 'Child' in scope
        child.id = UUID().uuidString
        child.name = name

        save()
    }

    func fetchChildList() -> [Child]? { // ==> Cannot find type 'Child' in scope
        let request = NSFetchRequest<Child>(entityName: "Child") // ==> Cannot find type 'Child' in scope
        guard let context = stack.context else { return nil}
        do {
            let items: [Child] = try context.fetch(request)
            return items // ==> Cannot find type 'Child' in scope
        } catch let error {
            print("Error fetching. \(error)")
            return nil
        }
    }

    private func save() {
        switch stack.save() {
        case .saved: print("Saved")
        case .rolledBack: print("RolledBack")
        case .hasNoChanges: print("HasNoChanges")
        }
    }
}

am I missing any configuration in Child/Parent app?

Solution Found reference:

  1. https://medium.com/@starecho/something-you-may-need-to-do-when-integrating-core-data-into-your-cocoapods-library-e8e8fad409b8

  2. error while build iOS app in Xcode : Sandbox: rsync.samba (13105) deny(1) file-write-create, Flutter failed to write to a file

enter image description here

enter image description here

0

There are 0 best solutions below