Start a new topic

KCSPersistable objects requires the `_id` property

Hello I am getting this error when calling my custom endpoint from iOS.


Any clues?


Hrisafis,


Please let me know if it is working for you with the latest version.

Here is a very basic sample:

Custom Endpoint (GetJobRoles) :
function onRequest(request, response, modules) {
 
response.body = [
  {
    "_id": "5660a505c7d171e54c034f97",
    "name": "Call Center",
    "_kmd": {
      "lmt": "2015-12-03T20:24:37.866Z",
      "ect": "2015-12-03T20:24:37.866Z"
    }
  },
  {
    "_id": "5660a5058cf3e5ad15033641",
    "name": "Administration",
    "_kmd": {
      "lmt": "2015-12-03T20:24:37.869Z",
      "ect": "2015-12-03T20:24:37.869Z"
    }
  }
  ]
 
 response.complete()
}

Calling the endpoint from the Swift Code:

                    KCSCustomEndpoints.callEndpoint(
                        "GetJobRoles",
                        params: nil,
                        completionBlock: { (results: AnyObject!, error: NSError!) -> Void in
                            if results != nil {
                               
                                print(results)
                               
                            } else {
                                //handle error
                            }
                        }
                    )


Thanks,

Pranav

Kinvey Support

[KCSCustomEndpoints callEndpoint:@"functionName" params:params completionBlock:^(id results, NSError *error) {

if (results) {

NSLog(@"%@",results);


} else {

NSLog(@"%@",error.description);


}

}];

Hrisafis,


Can you give me an example of the code that you're using?


Thanks,


I have also tried installing the latest version manually. Same problem.

Any ideas?

I am using pods so I guess the latest. I installed it yesterday. How can I check?

Hrisafis,


Which version of the iOS library are you using?  This was in issue in a few older versions but I believe that it has been resolved since then.


Thanks,

Login or Signup to post a comment