Originally created by @ogugo on GitHub (Dec 12, 2018).
Hey John,
Loving your project. I just wanted to check if I'm right assuming that there's a conflict using property keys that match with NSManagedObject instance properties. I've isolated the crashing code, which set off an infinite loop calling [NSManagedObject description], [NSManagedObject _descriptionValues], and then _PF_Handler_Public_GetProperty.
guard let _ = self.selectedRowIndexPath else {
os_log("Attempted to create new bulletin without a selected row.", log: Logger.presentation, type: .default)
fatalError("Attempted to create new bulletin without a selected row.")
}
let exercise = exercises[self.selectedRowIndexPath!]
let name = exercise.name.value
os_log("Creating bulletin item for %@.", log: Logger.presentation, type: .debug, name)
let page = BLTNPageItem(title: name)
page.image = exercise.getImage()
**page.descriptionText = exercise.description.value** // ERROR HERE
page.actionButtonTitle = "Favorite"
page.alternativeButtonTitle = "Hide"
page.isDismissable = true
page.appearance = makeExerciseDetailAppearance()
page.actionHandler = { (item: BLTNActionItem) in
CoreStore.perform(asynchronous: {(transaction) in
let proxy = transaction.edit(exercise)
proxy?.isFavorite .= true
}, completion: {(result) in
if result.boolValue {
os_log("Successfully added %@ to favorite exercises.", log: Logger.customization, type: .info, name)
}
else {
os_log("Could not add %@ to favorite exercises.", log: Logger.customization, type: .default, name)
}
})
item.manager?.dismissBulletin(animated: true)
os_log("Dismissing bulletin for %@/", log: Logger.presentation, type: .debug, name)
}
page.alternativeHandler = { (item: BLTNActionItem) in
item.manager?.dismissBulletin(animated: true)
os_log("Dismissing bulletin for %@/", log: Logger.presentation, type: .debug, name)
}
return page
}
Originally created by @ogugo on GitHub (Dec 12, 2018).
Hey John,
Loving your project. I just wanted to check if I'm right assuming that there's a conflict using property keys that match with NSManagedObject instance properties. I've isolated the crashing code, which set off an infinite loop calling [NSManagedObject description], [NSManagedObject _descriptionValues], and then _PF_Handler_Public_GetProperty.
private func makeExerciseDetailPage() -> BLTNItem {
guard let _ = self.selectedRowIndexPath else {
os_log("Attempted to create new bulletin without a selected row.", log: Logger.presentation, type: .default)
fatalError("Attempted to create new bulletin without a selected row.")
}
let exercise = exercises[self.selectedRowIndexPath!]
let name = exercise.name.value
os_log("Creating bulletin item for %@.", log: Logger.presentation, type: .debug, name)
let page = BLTNPageItem(title: name)
page.image = exercise.getImage()
**page.descriptionText = exercise.description.value** // ERROR HERE
page.actionButtonTitle = "Favorite"
page.alternativeButtonTitle = "Hide"
page.isDismissable = true
page.appearance = makeExerciseDetailAppearance()
page.actionHandler = { (item: BLTNActionItem) in
CoreStore.perform(asynchronous: {(transaction) in
let proxy = transaction.edit(exercise)
proxy?.isFavorite .= true
}, completion: {(result) in
if result.boolValue {
os_log("Successfully added %@ to favorite exercises.", log: Logger.customization, type: .info, name)
}
else {
os_log("Could not add %@ to favorite exercises.", log: Logger.customization, type: .default, name)
}
})
item.manager?.dismissBulletin(animated: true)
os_log("Dismissing bulletin for %@/", log: Logger.presentation, type: .debug, name)
}
page.alternativeHandler = { (item: BLTNActionItem) in
item.manager?.dismissBulletin(animated: true)
os_log("Dismissing bulletin for %@/", log: Logger.presentation, type: .debug, name)
}
return page
}
Oof, it's a no-no in Core Data to use any common NSObject property names, especially description.
You will want to rename this to property. Thanks for reporting this though, I'll write an assert that would catch these during DataStack initialization.
@JohnEstropia commented on GitHub (Dec 12, 2018):
Oof, it's a no-no in Core Data to use any common NSObject property names, especially `description`.
You will want to rename this to property. Thanks for reporting this though, I'll write an `assert` that would catch these during `DataStack` initialization.
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 @ogugo on GitHub (Dec 12, 2018).
Hey John,
Loving your project. I just wanted to check if I'm right assuming that there's a conflict using property keys that match with NSManagedObject instance properties. I've isolated the crashing code, which set off an infinite loop calling [NSManagedObject description], [NSManagedObject _descriptionValues], and then _PF_Handler_Public_GetProperty.
private func makeExerciseDetailPage() -> BLTNItem {
@JohnEstropia commented on GitHub (Dec 12, 2018):
Oof, it's a no-no in Core Data to use any common NSObject property names, especially
description.You will want to rename this to property. Thanks for reporting this though, I'll write an
assertthat would catch these duringDataStackinitialization.@ogugo commented on GitHub (Dec 12, 2018):
Ahhh, that explains it. Thanks!