[英]Failed to call designated initializer on NSManagedObject class ’XYX’ with RestKit-0.20.3
I am working with RestKit-0.20.3 and faced a problem I have a Student table in database. 我正在使用RestKit-0.20.3,遇到一个问题,我在数据库中有一个Student表。 For getting student history perform get api call, url like this https://xyz.com/api/getStudentHistory?x=a&y=b&z=c with some parameter.
要获取学生历史记录,请执行get api调用,网址为https://xyz.com/api/getStudentHistory?x=a&y=b&z=c(带有某些参数)。 Using this method
使用这种方法
[[RKObjectManager sharedManager] getObjectsAtPath:path parameters:param success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
In ' path' parameter passing- path = https://xyz.com/api/getStudentHistory 在`` 路径''参数传递中-路径= https://xyz.com/api/getStudentHistory
I got this error when server send response. 服务器发送响应时出现此错误。
CoreData: error: Failed to call designated initializer on NSManagedObject class ’Student’
After that I am getting this message and application become crash. 之后,我收到此消息,应用程序崩溃。
Uncaught exception [<Student 0xd36b3e0> valueForUndefinedKey:]: the entity (null) is not key value coding-compliant for the key "notes".
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Student 0xd36b3e0> valueForUndefinedKey:]: the entity (null) is not key value coding-compliant for the key "notes".'
After R&D and spending a lot of time got a clue from here The entity (null) is not key value coding-compliant for the key "title" 经过研发并花费大量时间从这里得到了一个线索实体(空)不符合密钥“ title”的编码要求
Simply replace my path parameter from path = https://xyz.com/api/getStudentHistory to path = /api/getStudentHistory in method 只需将方法中的path参数从path = https://xyz.com/api/getStudentHistory替换为path = / api / getStudentHistory
[[RKObjectManager sharedManager] getObjectsAtPath:path parameters:param success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
Now my problem solved……:) 现在我的问题解决了……:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.