NSInternalInconsistencyException _variable is not a property of projectName.Classname

0 votes

I'm trying to work with a DynamoDB table, and have successfully connected to it, but am unable to read it. When I try, I get the following error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_datePublished is not a property of ProjectName.Article.'

Here's my Article class/model:

class Article: AWSDynamoDBObjectModel, AWSDynamoDBModeling {

  var _articleSource: String?
  var _articleUrl: String?
  var _datePublished: String?
  var _headline: String?
  var _imageURL: String?
  var _rating: String?
  var _listingId: String?

  class func dynamoDBTableName() -> String {
    return "tableName"

  class func hashKeyAttribute() -> String {
    return "_listingId"

  class func rangeKeyAttribute() -> String {
    return "_articleUrl"

  override class func jsonKeyPathsByPropertyKey() -> [AnyHashable: Any] {
    return [
      "_articleSource" : "articleSource",
      "_articleUrl" : "articleUrl",
      "_datePublished" : "datePublished",
      "_headline" : "headline",
      "_imageURL" : "imageURL",
      "_rating" : "rating",
      "_listingId" : "listingId",

And the function I'm calling in ViewDidLoad to read an article from the DB:

 func readArticle() {
let dynamoDbObjectMapper = AWSDynamoDBObjectMapper.default()

// Create data object
let article: Article = Article();
  hashKey: "2018-03-17T08:50:30+00:00",
  rangeKey: "https://www.example.com",
  completionHandler: {
    (objectModel: AWSDynamoDBObjectModel?, error: Error?) -> Void in
    if let error = error {
      print("Amazon DynamoDB Read Error: \(error)")
    print("Article:\n \(article)")


What am I doing wrong? datePublished exists in that entry on the DB, and is defined in the model

Sep 7, 2018 in AWS by bug_seeker
• 15,300 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

It turns out the AWS SDK isn't exactly Swift 4 compatible yet. In swift 4, you have to put @objcMembers before the object model class definition like:

    @objcMembers class Article: AWSDynamoDBObjectModel, AWSDynamoDBModeling { 

answered Sep 7, 2018 by Priyaj
• 56,140 points

Related Questions In AWS

0 votes
1 answer

if instance is a part of some AutoScaling Group in AWS or not ?

You can run this command below on ...READ MORE

answered Jun 1, 2018 in AWS by Cloud gunner
• 4,240 points
0 votes
1 answer

What is the maximum storage capacity of a node in Redshift?

You can create a cluster using either ...READ MORE

answered Oct 26, 2018 in AWS by Archana
• 5,360 points
0 votes
1 answer

What is a DB Instance of Amazon RDS?

Hey @findingbugs, there are two question of ...READ MORE

answered Nov 19, 2018 in AWS by Priyaj
• 56,140 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

In Amazon Data Pipeline, how to make sure only once instance of a pipeline is running at any time?

On the CopyTablesActivity, you could set a lateAfterTimeout attribute ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 56,140 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.