Giter VIP home page Giter VIP logo

Comments (2)

loudmouth avatar loudmouth commented on August 11, 2024

Hi @edward121,

To use contentful-persistence, you need to make sure you call map

public func map(contentTypeId: String, to type: Resource.Type, propertyMapping: [String:String]? = nil)

To create a mapping from a field on a Contentful content type to an attribute on your CoreData data model.

As you can see in the photo you posted with your debug console, the mapping dictionary used to create a CoreData entry is empty in this case.

Your code should look something like the following:

self.synchronizer = ContentfulSynchronizer(client: self.client, persistenceStore: self.store)

self.synchronizer.mapAssets(to: Asset.self)
self.synchronizer.mapSpaces(to: SyncInfo.self)

// Replace With your Contentful content type id
self.synchronizer.map(contentTypeId: "CONTENTFUL_CONTENT_TYPE_ID", to: Record.self)

contentful-persistence will automatically infer the mapping dictionary, but for this to work, the field names on your content model must be the same as the property names on your CoreData Entity.
See the attached photo below to see a mapping dictionary that is complete:

screen shot 2017-03-06 at 09 45 14

from contentful-persistence.swift.

edward121 avatar edward121 commented on August 11, 2024

Thanks for your support.
There's the problem in the entity model definition.

from contentful-persistence.swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.