Comments (2)
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:
from contentful-persistence.swift.
Thanks for your support.
There's the problem in the entity model definition.
from contentful-persistence.swift.
Related Issues (20)
- [BUG] SynchronizationManager.seedDBFromJSONFiles throwing incorrect invalidFilePath HOT 1
- [Documentation] Missing reference to contentful-utilities HOT 2
- [BUG] Incremental sync issues with 0.17.1 HOT 5
- Changing of handling symbol arrays causes crash while seeding DB HOT 3
- After updating to the latest version of SDK 0.17.4, app crashes while syncing
- Crash on launch; dyld Symbol not found in Swift 5.4 / XCode 12.5 HOT 1
- To One relationship with mapped relationship name results in crash while trying to sync HOT 1
- Crash after mutating model that removes a references within resolveRelationships when cached.
- Sync not removing invalid relationships? HOT 1
- Sync not removing invalid relationships if a full sync is performed
- 'Cannot find 'SyncInfo' in scope' when loaded via SPM HOT 3
- Error When Building contentful-persistence.swift in Cartfile with new version of Swift
- SynchronizationManager.sync() throws JSON Decoding exception
- Update podspec to use contentful 5.0.0 HOT 1
- Property cannot be marked @NSManaged because its type cannot be represented in Objective-C HOT 2
- Use of unresolved identifier 'SyncInfo' HOT 1
- Update podspec HOT 2
- Persisting RichTextDocument HOT 12
- Force re-sync all the data possible? HOT 5
- Coredata relationship not getting synced when un-publishing and publishing an entry with reference HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contentful-persistence.swift.