- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Magical Record 导入从网络服务返回的数据。以下是json
{
"notes": null,
"logged_on": "2014-08-08",
"updated_at": "2014-08-08T15:33:25-04:00",
"user_id": 876,
"url": "https://august.roundtriptohealth.com/entries/5006",
"is_logged": true,
"id": 5006,
"entry_recording_activities": [
{
"recording_activity_id": 1,
"updated_at": "2014-08-08T16:39:19-04:00",
"url": "https://august.roundtriptohealth.com/entry_recording_activities/5006",
"recording_activity": {
"type_of_prompt": "textbox",
"updated_at": "2014-07-10T15:55:14-04:00",
"options": [],
"regex_validation": {
"message": "Up to three digits",
"name": "three_digits",
"regex": "^(\\d){1,3}$",
"display": "0 to 999"
},
"url": "https://august.roundtriptohealth.com/recording_activities/1",
"name": "Exercise Minutes",
"id": 1,
"cap_value": 360,
"summary": null,
"created_at": "2013-11-01T11:50:36-04:00",
"content": "**30+ minutes = 1 point**\n\nChoose a physical activity that elevates your heart, increases your breathing, and can be sustained for 30 minutes or more.\n\nWhen you and your Travel Companion log this activity the **same day**, you earn a bonus point and can visit a new attraction.",
"cap_message": "You have exceeded the maximum number of minutes."
},
"entry_id": 5006,
"id": 5006,
"value": "37",
"created_at": "2014-07-14T23:41:04-04:00"
},
{
"recording_activity_id": 1,
"updated_at": "2014-08-08T15:33:24-04:00",
"url": "https://august.roundtriptohealth.com/entry_recording_activities/16131",
"recording_activity": {
"type_of_prompt": "textbox",
"updated_at": "2014-07-10T15:55:14-04:00",
"options": [],
"regex_validation": {
"message": "Up to three digits",
"name": "three_digits",
"regex": "^(\\d){1,3}$",
"display": "0 to 999"
},
"url": "https://august.roundtriptohealth.com/recording_activities/1",
"name": "Exercise Minutes",
"id": 1,
"cap_value": 360,
"summary": null,
"created_at": "2013-11-01T11:50:36-04:00",
"content": "**30+ minutes = 1 point**\n\nChoose a physical activity that elevates your heart, increases your breathing, and can be sustained for 30 minutes or more.\n\nWhen you and your Travel Companion log this activity the **same day**, you earn a bonus point and can visit a new attraction.",
"cap_message": "You have exceeded the maximum number of minutes."
},
"entry_id": 5006,
"id": 16131,
"value": "45",
"created_at": "2014-08-08T15:33:24-04:00"
},
{
"recording_activity_id": 37,
"updated_at": "2014-08-08T15:33:24-04:00",
"url": "https://august.roundtriptohealth.com/entry_recording_activities/16132",
"recording_activity": {
"type_of_prompt": "checkbox",
"updated_at": "2014-07-30T13:42:27-04:00",
"options": [],
"regex_validation": null,
"url": "https://august.roundtriptohealth.com/recording_activities/37",
"name": "Eat 2 Different Colored Fruit Servings",
"id": 37,
"cap_value": null,
"summary": "You’ll make a couple of colorful choices on this week’s Tour Bus.",
"created_at": "2013-11-08T10:17:55-05:00",
"content": "By spreading daily choices across the rainbow of colors, you’ll get the best produce has to offer — vitamins, minerals, fiber, and phytochemicals — for better health and energy. Have at least 2 <a href=\"http://www.chow.com/assets/2011/05/FRUIT_VEG_SERVINGS.pdf\" target=\"_blank\">fruit servings (2 cups)</a>, each from a different color group: red, orange, yellow/white, green, and blue/violet.",
"cap_message": null
},
"entry_id": 5006,
"id": 16132,
"value": null,
"created_at": "2014-08-08T15:33:24-04:00"
}
],
"created_at": "2014-08-08T15:33:24-04:00"
}
我可以使用以下方法导入顶级对象:
[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
if ([responseObject isKindOfClass:[NSArray class]]) {
[Entry importFromArray:responseObject inContext:localContext];
}
}];
但是,第二层(数组 entry_recording_activities 内)不导入。我已经在数据模型文件中声明了条目。名为“Entry”的顶级对象。你可以从图像中看到。
二级对象如下:
relatedByAttribute 和关系也已设置。那么如何将数据导入多个条目(从顶层对象到低层对象)?
最佳答案
单击事件属性。在您的 relatedByAttribute 下,添加“mappedKeyName”,并添加嵌套路径。在这种情况下,entry_recording_activities。
基本问题是您已经定义了如何自动连接数据,但没有告诉导入库数据相对于导入开始的位置。
关于ios - 使用 Magical Record 在 NSDictionary 中导入数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25284917/
recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL
在我的表中,我有四列。 r_id id(用户 ID) v_id(公司 ID) 率 我所做的就是从用户那里对公司(v_id)进行评分。 假设,如果用户一对第一家公司(v_id)进行评分,那么当同一用户对
我的表中有 10 条记录,当我删除记录 5 并创建新记录时,新记录将取代已删除的记录,如下所示: 在删除之前记录其ID: 1个2个3个4个5个6个78个910 删除记录 5 并插入新记录后,id 为
我有两个 belongsToMany 模型: const apptsModel = db.define('Appts', { id: {type: Sequelize.INTEGER, pri
有没有办法在 iOS Playground 上使用录音机?运行时,它会询问我是否允许使用我的麦克风,并且录音机实例似乎可以正常工作,但是,我无法使用 record() 函数。我当前的环境是 iOS 1
我有 2 个表,状态表与配置文件表相连。 Profile 表存储唯一的 tagId,status 表存储多个重复的 tagid 条目。我想按tagid的最后一条记录和第一条记录分组显示。 表:简介注意
我是 的新手 typescript 我需要遍历 Record键入对值进行一些更新并返回 Record . 这是定义类型的方式: type Parent = Readonly>; type Childr
我发现在开发 extjs 应用程序(拉力赛应用程序)时,有时我需要从记录中获取的数据在 record.raw 中而不是在 record.data 中。两者有什么区别,为什么会这样? 编辑 - 添加示例
我需要交叉引用 2 个表。 在 tb1 中是 booking_ref,投资者 在 tb2 中是 booking_ref、investor、cost 麻烦的是如果没有成本,表2中没有记录 所以我有以下查
鉴于:我在 Kafka 中有两个主题,假设主题 A 和主题 B。Kafka Stream 从主题 A 读取记录,处理它并生成与消费记录相对应的多条记录(假设记录 A 和记录 B)。现在,问题是如何使用
我有一个包含 6 个元素的排序数组列表。前 5 个元素有一些值,第 6 个元素为空。 我想循环遍历这个ArrayList,并将第一个记录的前5个元素与下一个记录中的相同元素进行比较。如果任一元素不同,
我有一个包含 3 列的表:ID、Name、ParentID。 如何删除特定记录及其所有子记录(n 层深)? 使用 Entity Framework 3.5。 最佳答案 表是自引用的是应用程序逻辑,它没
获取记录时如何获取最新的记录? 例如: 第一次迭代我用对象名称 Country 保存“Singapore”, 第二次迭代我用对象名称 Country,second 保存“USA” 现在当我获取它的时候
我将使用 C# 和 Xamarin 制作的 iOS 应用重写到 Swift,原因很明显是 Xamarin 的定价和低文档。正在关注this tutorial因为在我的 UITableView 上包含一
假设我有一个线束二进制文件,它可以根据命令行选项产生不同的基准。我对采样这些基准非常感兴趣。 我有3个选择: 更改线束二进制文件以生成一个“性能记录”子进程,该子进程运行基准测试并进行采样 只需执行“
什么 SQL 查询会按名称查找记录,以及具有相同地址但可能不同名称的所有记录? 我有一个选民登记数据库,当我查找个人时,我还想看看还有谁在该地址登记。 我的数据库称为 voters,其中的表称为 ex
我在我的 mac 上设置了一个 Tsung 配置,并尝试在我正在开发的网站上记录一个测试。 我跑了:“tsung-recorder start”并在 firefox localhost:8090 中为
我需要将 JOOQ 的记录结果集转换为表记录列表。有什么方法可以做到吗? 最佳答案 是的,您可以使用 Result.into(Table) .一个例子: Result result = create.
我正在尝试将 CKReference 添加到云工具包中的记录,但尝试不断触发“服务记录已更改”。从我的 println 显示的控制台消息(下面的控制台消息和代码), 我正在上传带有 0 个引用的记录,
我有两个类:Artist 和 Instrument。每个 Artist 可以演奏一个或多个 Instrument。每个 Instrument 可以分配给一个或多个 Artist。所以,我设置了以下类:
我是一名优秀的程序员,十分优秀!