- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
{
"JobID" : "aaaabbbb-dddd-eeee-ffff-aaaabbbbcccc",
"UserID": "11112222-dddd-eeee-ffff-111122223333",
"FolderVersions" : [
{
"FolderID" : "11112222-dddd-eeee-ffff-111122223333",
"Version" : "1.0"
},
{
"FolderID" : "11113333-dddd-eeee-ffff-111122223333",
"Version" : "1.2"
},
{
"FolderID" : "33332222-dddd-eeee-ffff-111122223333",
"Version" : "1.1"
}
]
}
我有包含 jobid、userid 和 nsmutable_array“folderversion”的作业类
FolderVersions:使用具有folder_id和版本的FolderVersion类进行映射
我希望将FolderVersions映射到作业类中的folderversion数组
RKObjectMapping *jobMapping = [RKObjectMapping mappingForClass:[Job class]];
[jobMapping addAttributeMappingsFromDictionary:@{
@"JobID" : @"jobId",@"USerID":@"userID"
}];
RKObjectMapping *folderMapping = [RKObjectMapping mappingForClass:[FolderVersion class]];
[folderMapping addAttributeMappingsFromDictionary:@{@"FolderID":@"folderID",
@"Version":@"version",
}];
RKResponseDescriptor *responseDescripor1 = [RKResponseDescriptor jobMapping
method:RKRequestMethodPOST pathPattern:@"/xxx/response.php/json/response"
keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
最佳答案
您需要向 jobMapping
添加关系映射,它将 Job
类中的键链接到 JSON 中的键 (FolderVersions
code>) 并指定它应该使用 folderMapping
来存储内容:
[jobMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"FolderVersions" toKeyPath:@"folderversion" withMapping:folderMapping]];
关于iphone - Reskit v0.2 json 格式映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17897629/
我正在尝试运行一些单元测试来测试我与 RestKit v0.20 的映射,但是我收到一个错误消息,指出我的目标对象为 nil。我已经追踪到映射失败的事实,因为 sourceType 是一个 NSArr
我只是想问一下,是否有办法解析Reskit中的以下字段“mods”: post_count: false, sitename: "Mercury", mods: false, admin_email:
经过长时间的研究,我正在写这篇文章,但我真的很难找到解决我问题的最佳方法。 我对 resKit 和 CoreData 都很陌生......无论如何,我正在映射并保存我从 Web 服务接收到的 JSON
先是结构,再是解释 •[J] (json 根) ••[A] (A 对象数组) •••[A1] (A1的数据) •••[A2] (A2的数据) •••[A3] ( ... ) •••• [A3.B] (
嗨 stackoverflow 社区,我正在使用 RKObjectManager 发出 iOS RESTful 请求以将响应映射到本地对象。 我对 Restkit 的问题是在不同的请求中为同一个元素注
提取后数据库中出现重复项。 下面是映射和获取代码: +(RKEntityMapping *)userMapping:(RKEntityMapping *)userMapping { [user
我正在后台线程中执行 getObjectsAtPath。但是,成功/失败 block 是在 UI 线程上调用的。 有没有办法强制 RestKit 在同一个线程而不是 UI 线程上调用成功和失败 blo
我正在尝试映射 RSS 提要的项目。 RKObjectRequestOperation 返回对象的确切数量,但属性值为 nil。以下是我的代码 NSURL *requestURL = [NSURL
在我的应用程序中,我进行了不同的调用,除了一个调用外,它们都有效,该调用仅返回一个字符串作为响应作为 SUCCESS。我收到这个错误 "The operation couldn’t be comple
我正在尝试用 key 包装我的 HTTP POST 请求。换句话说,我想把这个: { "category_id"=>"1", "food_name_token"=>"Pizza", "id"=>"1
我正在尝试将 RestKit 与 Django-Tastypie 创建的 REST API 绑定(bind)。GET 操作运行良好,但 POST 操作有奇怪的行为:在数据库中创建了一行,但所有字段都是
{ "JobID" : "aaaabbbb-dddd-eeee-ffff-aaaabbbbcccc", "UserID": "11112222-dddd-eeee-ffff-111122223333"
我很困惑要遵循什么 REST API 才能与 RestKit 同步。我在发出放置/发布/删除请求时遇到问题。 我遵循的 REST API 之一来自 NetTuts我发现很难与 RestKit 同步。
我有以下代码: NSString *url = @"http://mysite.com" RKURL *baseURL = [RKURL URLWithBaseURLString:url];
我将如何使用 Restkit 上传音频文件?我查看了文档,似乎找不到有关上传文件的任何信息。感谢您的帮助。 最佳答案 本文解释了如何:http://mobile.tutsplus.com/tutori
我有一个现有的 Core Data 应用程序,我现在想为其添加 REST 支持以远程存储我的对象。我决定集成 RestKit,因为它似乎(到目前为止)是最成熟的 REST 支持框架,但我对它的核心数据
我完全按照 RestKit 设置说明进行操作,但我在带库的链接二进制文件中得到的 libRestKit.a 是红色的。 安装说明: https://github.com/RestKit/RestKit
我是一名优秀的程序员,十分优秀!