I'm not sure what leads to this issue. I have a ListMonitor that populates a table view. My understanding is that once the notes are imported, then the ListMonitor will make them available on main thread and my table view will be populated, etc.
No need to use fetchExisting() to pass instances back to the main thread when using a ListMonitor, correct?
If I comment the employee property that is being set, I do not have the above issue.
Note: this same employee instance is also set as a property inside a singleton class instance (at app launch, before this Note importation is being done). So I suspect the issue to be somehow related to that, but cannot understand why?
Thanks a lot for this great project and your time.
Teddy
Originally created by @TeddyDreyfus on GitHub (May 7, 2019).
Hi John,
I have the following question if you can help me. The `employee` property that is being set below cause me issue:
```
extension Note: ImportableUniqueObject
{
typealias ImportSource = [String: Any]
class var uniqueIDKeyPath: String
{
return #keyPath(Note.id)
}
var uniqueIDValue: String
{
get { return self.id! }
set { self.id = newValue }
}
class func uniqueID(from source: ImportSource, in transaction: BaseDataTransaction) throws -> String?
{
return source["Id"] as? String
}
func update(from source: ImportSource, in transaction: BaseDataTransaction) throws
{
self.id = source["Id"] as? String
self.employeeId = source["EmployeeId"] as? String
if let employeeDTOJSON = source["EmployeeDTO"] as? [String:AnyObject]
{
self.employee = try! transaction.importUniqueObject(Into<Employee>(), source: employeeDTOJSON)!
}
}
}
```
The issue I get is:
[CoreStore: Error] NSManagedObjectContext+Transaction.swift:203 saveAsynchronouslyWithCompletion
↪︎ Failed to save 'NSManagedObjectContext'.
(CoreStore.CoreStoreError) .internalError (
.errorDomain = "com.corestore.error";
.errorCode = 5;
.NSError = (
.domain = "NSCocoaErrorDomain";
.code = 1560;
.userInfo = 1 key-value(s) [
"NSDetailedErrors" = (
"Error Domain=NSCocoaErrorDomain Code=1570 \"The operation couldn\U2019t be completed. (Cocoa error 1570.)\" UserInfo={NSValidationErrorObject=<Employee: 0x600002cb2b20>
I'm not sure what leads to this issue. I have a ListMonitor<Note> that populates a table view. My understanding is that once the notes are imported, then the ListMonitor will make them available on main thread and my table view will be populated, etc.
**No need to use fetchExisting() to pass instances back to the main thread when using a ListMonitor, correct?**
If I comment the `employee` property that is being set, I do not have the above issue.
**Note:** this same employee instance is also set as a property inside a singleton class instance (at app launch, before this Note importation is being done). So I suspect the issue to be somehow related to that, but cannot understand why?
Thanks a lot for this great project and your time.
Teddy
I just realized what was wrong in my code. Due to bad mapping in update() method, I was overriding and setting to nil a property, configured with a default value and not optional. The property being nil was leading to this issue upon insert. All good!
@TeddyDreyfus commented on GitHub (May 8, 2019):
I just realized what was wrong in my code. Due to bad mapping in update() method, I was overriding and setting to nil a property, configured with a default value and not optional. The property being nil was leading to this issue upon insert. All good!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @TeddyDreyfus on GitHub (May 7, 2019).
Hi John,
I have the following question if you can help me. The
employeeproperty that is being set below cause me issue:The issue I get is:
[CoreStore: Error] NSManagedObjectContext+Transaction.swift:203 saveAsynchronouslyWithCompletion
↪︎ Failed to save 'NSManagedObjectContext'.
(CoreStore.CoreStoreError) .internalError (
.errorDomain = "com.corestore.error";
.errorCode = 5;
.NSError = (
.domain = "NSCocoaErrorDomain";
.code = 1560;
.userInfo = 1 key-value(s) [
"NSDetailedErrors" = (
"Error Domain=NSCocoaErrorDomain Code=1570 "The operation couldn\U2019t be completed. (Cocoa error 1570.)" UserInfo={NSValidationErrorObject=<Employee: 0x600002cb2b20>
I'm not sure what leads to this issue. I have a ListMonitor that populates a table view. My understanding is that once the notes are imported, then the ListMonitor will make them available on main thread and my table view will be populated, etc.
No need to use fetchExisting() to pass instances back to the main thread when using a ListMonitor, correct?
If I comment the
employeeproperty that is being set, I do not have the above issue.Note: this same employee instance is also set as a property inside a singleton class instance (at app launch, before this Note importation is being done). So I suspect the issue to be somehow related to that, but cannot understand why?
Thanks a lot for this great project and your time.
Teddy
@TeddyDreyfus commented on GitHub (May 8, 2019):
I just realized what was wrong in my code. Due to bad mapping in update() method, I was overriding and setting to nil a property, configured with a default value and not optional. The property being nil was leading to this issue upon insert. All good!