Start a new topic

No more pure data container in 1.31

I'm using a NSMutableDictionary object class to save/load from Kinvey. It works great with 1.30.0 but 1.31.0, and 1.31.1 gives me an error _id cannot be empty.

Is this a documented change in functionality?


I do have a business logic intercepting the request, but I don't think it has any impact. My app rely on that feature, so I had to go back to 1.30.0 andt the issue did not show up with the same code:

 NSMutableDictionary *event = [[NSMutableDictionary alloc] initWithObjectsAndKeys:

    @"",KCSEntityKeyId,

    date,@"date",

    nil

  ];

   KCSCachedStore *_store = [KCSCachedStore storeWithOptions:@{KCSStoreKeyCollectionName:@"event",

                          KCSStoreKeyCollectionTemplateClass:[NSMutableDictionary class],

                                     KCSStoreKeyCachePolicy:@(KCSCachePolicyNone),

                            KCSStoreKeyOfflineUpdateEnabled:@YES}];

  [_store saveObject:event withCompletionBlock:nil withProgressBlock:nil];


I've had a lot of business errors lately - from '2000ms timeout reached' to '_id already exists' - appearing randomly on code that used to work. Maybe it's related.

I'll try again with 1.31.1 and let you know.

Igor:


You don't need to do the _id=  stuff.   The id should be automatically manage by Kinvey.   Your first request of:  


NSMutableDictionary *event = [[NSMutableDictionary alloc] initWithObjectsAndKeys:

    @"",KCSEntityKeyId,

    date,@"date",

    nil

  ];


Could be rewritten as:

 NSMutableDictionary *event = [[NSMutableDictionary alloc] initWithObjectsAndKeys:

    date,@"date",

    nil

  ];

And should work as anticipated.


Please let me know if this helps.

Igor, 


can you show me the code you used with id removed?


Thanks,

Removing _id doesn't help. Same error.

Igor,


Can you confirm that you are not using any type of business logic that may be causing this to happen?


Also, have you performed a regression test using the 1.30 library to confirm that the same code is still working with an older version of the library?


Thanks,

Same problem with 1.31.1:

Kinvey (1.31.1) status: Kinvey Service is alive, version: 3.3.33, response: myApp

Error saving event '{

    "_id" = "";

    date = "2015-05-18";

} Error Domain=KinveyError Code=406 "KCSPersistable objects requires the `_id` property" UserInfo=0x1a582310 {NSLocalizedFailureReason=KCSPersistable objects requires the `_id` property, NSLocalizedDescription=KCSPersistable objects requires the `_id` property}':


The request is rejeject before reaching my business logic, so not a BL issue.
It seems the _id property is not auto generated anymore.

Login or Signup to post a comment